【发布时间】:2020-02-09 11:06:29
【问题描述】:
对不起,我的英语不好,我无法很好地解释。
我有一个带有 Nginx 的 Windows Server 2012 的 VPS,并在端口 4000 上运行 Node 服务器,在端口 3000 上运行 React 客户端。
在远程桌面网站中运行在本地主机地址,但是当我在其他设备中使用服务器的静态 IP 时,我得到了来自服务器的任何响应。
无法访问此站点 XXX.XXX.192.176 响应时间过长。
我设置了IIS并连接到服务器,但是当IIS启动时,nginx无法启动。
nginx配置如下:
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name _;
location /api {
proxy_pass http://localhost:4000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
location /socket.io {
proxy_pass http://localhost:4000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
location / {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
【问题讨论】:
标签: node.js reactjs nginx server windows-server-2012