我这边的环境就是windows了: 我的conf文件是这样配置的(主要部分):
upstream mysite.com{
server 127.0.0.1:3000;
}
server {
listen 0.0.0.0:8080;
server_name mysite.com;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
proxy_pass http://127.0.0.1:3000;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_read_timeout 300s;
}
}
当我键入mysite.com时就是出现not found之类的。我在stackoverflow上也找了一下,但是还是没有解决。 所以在这里希望能得到准确的解答。同时也给以后遇到类似于此问题的同学一个解决的方法。:)
9 回复
我的 nginx (Tengine) 配置是这样的,运行是成功的,cookie、session什么的也都正常:
http { server { listen 80; server_name localhost; location /{ proxy_pass http://nodejs_upstream/; } location /http-bind/ { proxy_pass http://localhost:7070/http-bind/; } } upstream nodejs_upstream { server 127.0.0.1:3000; } }
upstream nodejs__upstream2 {
server 127.0.0.1:3000;
keepalive 64;
}
server {
listen 8080;
server_name localhost;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
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://nodejs__upstream2;
}
}
需要nginx -s reload
,你确保都执行了吗?