繁体   English   中英

如何使用Nginx在子域上禁用域代理重定向?

[英]How to disable domain proxy redirect on a subdomain with nginx?

我的nginx conf.d上有三个文件-

example.com 
www.example.com
other.example.com

example.com是我的首选域,并且是通过nodejs应用程序的代理。

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具有以下配置:

server{
    listen 80;
    server_name www.example.com;
    return 301 $scheme://example.com$request_uri;
}

在other.example.com中,我有以下配置

server {
    listen 80;
    server_name other.example.com;
    proxy_redirect off;
    root /opt/other;
    index index.html;
}

但是当我转到other.example.com时,我得到的结果与www.example.com和example.com相同

有什么想法如何解决此问题?

问题解决了。

我忘了以.conf扩展名命名other.example.com文件。

感谢@Curious

暂无
暂无

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

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