
実行時に次の警告を解決する方法がわかりませんnginx -t
:
2022/12/29 05:10:23 [warn] 24920#24920: conflicting server name "" on 0.0.0.0:80, ignored
2022/12/29 05:10:23 [warn] 24920#24920: conflicting server name "" on [::]:80, ignored
私のサーバーでは 2 つのサイトが稼働しています。
- ホーム.conf
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/home;
index index.html
server_name int.mycompany.lan;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
}
- バグ.conf
server {
listen 80;
listen [::]:80;
root /var/www/bug;
index index.html
server_name bug.int.mycompany.lan;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
}
現場に行くバグ.int.mycompany.lanいつも私に見せてくれるint.mycompany.lan代わりにサイトにアクセスしてください。
/etc/nginx/sites-enabled からこれらのファイルのいずれかへのシンボリック リンクを削除するか、いずれかのサイトのポートを 8081 などに変更すると、上記のエラーは発生しなくなります。
答え1
ばかげたミスです。行のセミコロンを削除してしまいましたindex
。それに気づくのに数時間かかりました。