使用Nginx,我爲包含四個單獨站點的服務器創建了一個多域設置。當我啓動Nginx時,我收到一條錯誤消息,這些網站似乎混在一起,因爲輸入一個網址會導致其他網站之一。一臺服務器上的多個域指向錯誤的站點
顯示的錯誤信息 -
Restarting nginx: nginx: [warn] conflicting server name "localhost" on 0.0.0.0:80, ignored
nginx: [warn] conflicting server name "localhost" on 0.0.0.0:80, ignored
nginx: [warn] conflicting server name "localhost" on 0.0.0.0:80, ignored
nginx.
我已經成立了類似的方式全部四個領域在各自的文件在/站點可用 -
server {
listen 80;
root /var/www/example.com/public_html;
index index.php index.html index.htm;
server_name example.com www.example.com;
location/{
try_files $uri $uri/ /index.html;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
我檢查和/ sites-enabled中沒有默認文件。猜測Nginx主配置中可能存在錯誤的設置,但不確定要查找什麼。
也許你已經在主配置文件中定義的'server'('nginx.conf')? –
不,只需http和事件選項。特別是我應該尋找什麼? –
我問,因爲默認的'nginx.conf'有一堆例子'服務器'塊,也許你忘了刪除它們。什麼是你的主要配置文件?你可以發佈到pastebin或類似的東西嗎? –