nodejs项目部署上线(nginx版)

2020-07-07  本文已影响0人  出来打我略略略

上线

    npm cache clean -f      //第一步:先清除npm缓存:
    npm install -g n        //第二步:安装n模块:
    n stable                //第三步:升级node.js到最新稳定版:

绑定域名

    upstream web{
        server 127.0.0.1:3000;
        keepalive 64;
    }
    server {
        listen 80;
        server_name 域名;
        #access_log /var/log/nginx/log/host.access.log main;
        #client_max_body_size 100m;
        location / {
            proxy_read_timeout 300;
            proxy_pass http://web;
            proxy_set_header Host $http_host;
        }
        error_page 404 /404.html;
        location = /50x.html {
            root /usr/share/nginx/html;
            proxy_set_header Host $http_host;
        }
    }
上一篇 下一篇

猜你喜欢

热点阅读