我有一個域example.com
和「替代」some-example.com
。我試圖從some-example.com
直接流量example.com
在使用nginx的一個簡單的服務器的聲明如下:Nginx服務器匹配太多的URL
server {
listen 80;
server_name some-example.com;
rewrite ^/(.*) http://example.com/$1 permanent;
}
我不是100%肯定,如果這是正確的規則,但我有另一個虛擬主機上服務器,這不是問題所在,但有必要了解我遇到的問題。
server {
listen 8745;
server_name localhost;
<other stuff goes here>
}
打到<my server IP>:8745
將去那個虛擬主機,按預期工作。不過我有另一虛擬主機是這樣的:
server {
listen 8746;
server_name localhost;
<other stuff goes here>
}
但是我所有的要求,以<my server IP>:8746
打example.com
。我很困惑,我沒有真正理解nginx,所以任何幫助,將不勝感激,爲什麼發生這種情況。我在開始時就提到過這個規則,因爲我認爲它與此有關。如果需要更多信息,我可以提供。
(同樣,這會爲服務器故障是更好嗎?)
如果刪除該重寫規則,它是否可以解決問題?此外,我想你將不得不提供更多的信息(完整的配置文件(S)) – 2010-02-19 13:01:27
這是在ServerFault上回答(嗯,我想通了)。看到這裏:http://serverfault.com/questions/113199/nginx-server-matching-too-many-urls它必須與Wordpress反彈URL到我的IP端口80.我應該提到它運行Wordpress。 – Zack 2010-02-21 17:12:18