3
我最近升級了(Debian)到nginx 1.2.1,現在看起來nginx總是用默認服務器響應,即使它不應該。爲什麼nginx總是迴應默認網站,即使它現在應該?
/etc/nginx/conf.d
server {
listen 80 default_server;
server_name _;
server_name_in_redirect off;
proxy_intercept_errors on;
return 401;
}
/etc/nginx/sites-enabled/search.config
server {
listen 80; ## listen for ipv4
server_name search.example.com;
location/{
proxy_pass http://search.example.com:8080;
proxy_set_header X-Real-IP $remote_addr;
}
}
當我嘗試訪問:http://search.example.com它會給我的401而不是端口8080上的內容(如果直接使用,它將起作用)。
另外'.config'是相當不尋常的文件擴展名,確保有一個實際的'include sites-enabeld/*。config'行在你的配置中的某處。 (更典型的結尾是'* .conf'。) – Gnarfoz
我知道,但是mc確實只在你使用'config'而不是'conf'的情況下正確地突出顯示文件。考慮到這個時間浪費,也許這不是一個好主意。 – sorin
那麼,您可以調整vim的配置,並將'nginx.conf'中的'include'行改爲'include sites-enabled/*。config'。 ;-) – Gnarfoz