[英]How to disable domain proxy redirect on a subdomain with nginx?
I have three files on my nginx conf.d - 我的nginx conf.d上有三个文件-
example.com
www.example.com
other.example.com
example.com is my preferred domain and is proxy passing a nodejs app. example.com是我的首选域,并且是通过nodejs应用程序的代理。
example.com has the following config example.com具有以下配置
server {
listen 80;
server_name example.com;
location / {
proxy_pass http://localhost:8081;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
www.example.com has the following config: www.example.com具有以下配置:
server{
listen 80;
server_name www.example.com;
return 301 $scheme://example.com$request_uri;
}
In other.example.com I have the following config 在other.example.com中,我有以下配置
server {
listen 80;
server_name other.example.com;
proxy_redirect off;
root /opt/other;
index index.html;
}
But when I go to other.example.com I get the same result as www.example.com and example.com 但是当我转到other.example.com时,我得到的结果与www.example.com和example.com相同
Any thoughts how to fix this behaviour? 有什么想法如何解决此问题?
Problem Solved. 问题解决了。
I forgot to name other.example.com file with the .conf extension. 我忘了以.conf扩展名命名other.example.com文件。
thanks to @Curious 感谢@Curious
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.