Nginx反向代理部署NodeJS项目

时间:2023-03-09 20:07:53
Nginx反向代理部署NodeJS项目

在nginx配置文件种的http节点下:

server {
listen 8005;
server_name localhost;
location /{
proxy_set_header X_Real_IP $remote_addr;
proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_pass http://127.0.0.1:3000;
proxy_redirect off;
}
}

浏览器输入http://localhost:8005,nginx代理到http://localhost:3000/