• (后续补充)vue+express、gitee pm2部署轻量服务器


    首先 防火墙全部关闭算了

    首先 防火墙全部关闭算了

    首先 防火墙全部关闭算了

    首先 防火墙全部关闭算了

    首先 防火墙全部关闭算了

    首先 防火墙全部关闭算了

    关闭防火墙

    systemctl stop firewalld

    重新载入防火墙使设置生效
    firewall-cmd --reload

    后端的 pm2.config.cjs 更改为

    1. module.exports = {
    2. apps: [
    3. {
    4. name: 'mskk-server',
    5. script: 'app.js', // 你的入口文件
    6. instances: 1,
    7. autorestart: true,
    8. watch: false,
    9. max_memory_restart: '1G',
    10. env: {
    11. NODE_ENV: 'production'
    12. }
    13. }
    14. ]
    15. };

    其次 前端打包 dist  使用 http-server 部署,上传到当前位置

    更改  /etc/nginx/nginx.conf 为

    1. user root;
    2. worker_processes auto;
    3. error_log /var/log/nginx/error.log notice;
    4. pid /var/run/nginx.pid;
    5. events {
    6. worker_connections 1024;
    7. }
    8. http {
    9. include /etc/nginx/mime.types;
    10. default_type application/octet-stream;
    11. log_format main '$remote_addr - $remote_user [$time_local] "$request" '
    12. '$status $body_bytes_sent "$http_referer" '
    13. '"$http_user_agent" "$http_x_forwarded_for"';
    14. access_log /var/log/nginx/access.log main;
    15. sendfile on;
    16. #tcp_nopush on;
    17. keepalive_timeout 65;
    18. #gzip on;
    19. include /etc/nginx/conf.d/*.conf;
    20. server {
    21. listen 443 ssl;
    22. ssl_certificate mengxin666888.asia_bundle.crt;
    23. ssl_certificate_key mengxin666888.asia.key;
    24. server_name mengxin666888.asia www.mengxin666888.asia;
    25. location / {
    26. root /etc/nginx/demo;
    27. index index.html index.htm;
    28. }
    29. location /aaa9527/ {
    30. proxy_pass http://127.0.0.1:8889/;
    31. }
    32. }
    33. }

    执行 npm install -g http-server 全局安装 

    然后切换到 dist 文件下

    运行 http-server

    等到所有的东西弄完之后,再进行部署,

     /etc/nginx/nginx.conf 文件中

    开头的  user  nginx; 替换成  user root;

    最终的文件

    1. user root;
    2. worker_processes auto;
    3. error_log /var/log/nginx/error.log notice;
    4. pid /var/run/nginx.pid;
    5. events {
    6. worker_connections 1024;
    7. }
    8. http {
    9. include /etc/nginx/mime.types;
    10. default_type application/octet-stream;
    11. log_format main '$remote_addr - $remote_user [$time_local] "$request" '
    12. '$status $body_bytes_sent "$http_referer" '
    13. '"$http_user_agent" "$http_x_forwarded_for"';
    14. access_log /var/log/nginx/access.log main;
    15. sendfile on;
    16. #tcp_nopush on;
    17. keepalive_timeout 65;
    18. #gzip on;
    19. include /etc/nginx/conf.d/*.conf;
    20. server {
    21. listen 443 ssl;
    22. ssl_certificate mengxin666888.asia_bundle.crt;
    23. ssl_certificate_key mengxin666888.asia.key;
    24. server_name mengxin666888.asia www.mengxin666888.asia;
    25. location / {
    26. root /etc/nginx/demo;
    27. index index.html index.htm;
    28. # 修改前端请求的代理路径
    29. proxy_pass http://127.0.0.1:8889/;
    30. }
    31. }
    32. }

    前端 vue 项目路径 

  • 相关阅读:
    腾讯云颜松柏:详解DevOps成熟度模型与效能度量
    控制系统典型应用车型 —— 牵引式移动机器人
    深入解析分布式限流
    jquery的基本使用
    如何依据环境试验标准开展试验?
    Qt窗体设计的布局
    代码安全与质量 | 在这个充满变数的时代,花小钱办大事
    Spring Cloud Alibaba组件Nacos
    .NET实现获取NTP服务器时间并同步(附带Windows系统启用NTP服务功能)
    2024年河北省计划招聘“特岗计划”教师2300名
  • 原文地址:https://blog.csdn.net/czxvzxzczcc/article/details/134226985