繁体   English   中英

Nginx配置

[英]Nginx configuration

在下面的代码中,我通过nginx重定向到http://127.0.0.1:3000/app1/namelist/name=xyz 当我点击http://127.0.0.1:80/ ,它将引发错误“ Cannot GET /”。 我该如何解决这个问题?

如果我直接点击127.0.0.1:3000/app1/namelist/name=xyz ,它应该通过nginx重定向。 是否可以在Nginx中进行配置?

#user  nobody; worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;

events {
    worker_connections  1024; 
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;  
    upstream node_entry {
        server 127.0.0.1:3000; 
    }

    server {    
        listen       80;
        server_name  127.0.0.1;

        location / {
            #root   html;
            #index  index.html index.htm;
            #return 503;
            proxy_pass     http://node_entry/;
        }
    }
}

好吧,就nginx而言,我将从代理通过行中删除尾部斜杠,因此它看起来像这样:

proxy_pass http:// node_entry ;

如果这不起作用,则响应必须来自上游。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM