nginx部署node项目

2019年06月20日 06:14:16

yum install nginx

vim /etc/nginx.conf

##去掉#

include /etc/nginx/conf.d/*.conf;

cd /etc/nginx/conf.d/

vim com.kacoro.conf

 upstream sample {

       server 127.0.0.1:3000;

       keepalive 64;

      }

     server {

        listen 80;

      server_name kacoro.com;

      location / {

        proxy_redirect off;

        proxy_set_header X-Real-IP $remote_addr;

        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

        proxy_set_header X-Forwarded-Proto $scheme;

        proxy_set_header Host $http_host;

        proxy_set_header X-NginX-Proxy true;

        proxy_set_header Connection "";

        proxy_http_version 1.1;

        proxy_pass http://sample;

      }

    }

保存

systemctl restart nginx