[英]Nginx configuration
In the below code Im redirecting through nginx to http://127.0.0.1:3000/app1/namelist/name=xyz
. 在下面的代码中,我通过nginx重定向到
http://127.0.0.1:3000/app1/namelist/name=xyz
。 When I hit http://127.0.0.1:80/
, it throws an error "Cannot GET/". 当我点击
http://127.0.0.1:80/
,它将引发错误“ Cannot GET /”。 How can I resolve this problem? 我该如何解决这个问题?
If I directly hit 127.0.0.1:3000/app1/namelist/name=xyz
, it should redirect via nginx. 如果我直接点击
127.0.0.1:3000/app1/namelist/name=xyz
,它应该通过nginx重定向。 Is it possible to configure in 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/;
}
}
}
Well, as far as nginx is concerned, I would remove the trailing slash from your proxy pass line so it looks like this: 好吧,就nginx而言,我将从代理通过行中删除尾部斜杠,因此它看起来像这样:
proxy_pass http://node_entry ; proxy_pass http:// node_entry ;
If that doesn't work, the response must be coming from your upstream. 如果这不起作用,则响应必须来自上游。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.