2012-11-07 77 views
0

如何在nginx上設置重定向? 我需要實現的是將舊域重定向到作爲服務器名稱的新域。 試圖使用重寫我得到的問題,因爲與它我需要設置爲服務器名稱舊域和新的重寫。從舊域重定向到新域

回答

1
server { 
    server_name old.example.com; 
    return 301 http://new.example.org/; 
} 

server { 
    server_name new.example.org; 


    location/{ 
     ... 
    } 


} 
+0

取而代之的是使用return我在不同的配置文件上使用rewrite –

0

嘗試在舊主機名的服務器塊配置中使用「proxy_pass example.newdomain.com:8080」指令。

+0

proxy_pass已被用來重定向到正確的端口 –

相關問題