0

I currently have two enabled site configurations in nginx, let us call them old-site.example and new-site.example. There is no other site configuration active.

old-site.example should 301-redirect to new-site.example. This currently works well as long as the old-site.example configuration is alone. After adding the new-site.example configuration file, it does not redirect anymore.

oldsite.conf:

server {
        listen 80;
        server_name *.old-site.example;
        rewrite_log on;
        location / {
                return 301 http://www.new-site.example$request_uri;
        }

}

newsite.conf:

server {
    listen       80;
    server_name  www.new-site.example;

charset utf-8;

    location / {
        #forward to application server
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://127.0.0.1:8080;
    }
}

other configuration details:

  • JBoss AS7 as application server running behind Nginx 1.5.1
4

1 回答 1

0

这是一个与 DNS 相关的错误,对不起大家。

背景:客户端的 ISP 设法“智能重定向”域而不是使用 DNS。他们基本上在他们的服务器上抓取了新站点并通过旧域返回它。我无语了。

如果您遇到过这样的问题,请在再次猜测您的配置之前检查 DNS 解析。

于 2013-08-26T18:18:30.547 回答