
실행할 때 다음 경고를 해결하는 방법을 알 수 없습니다 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
내 서버에는 두 개의 사이트가 실행되고 있습니다.
- home.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;
}
}
- bug.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;
}
}
사이트로 이동bug.int.mycompany.lan항상 나에게 보여주네int.mycompany.lan대신 사이트.
/etc/nginx/sites-enabled에서 이러한 파일 중 하나에 대한 심볼릭 링크를 제거하거나 사이트 중 하나의 포트를 8081과 같은 것으로 변경하면 더 이상 위의 오류가 발생하지 않습니다.
답변1
어리석은 실수. 해당 줄에서 세미콜론을 삭제했습니다 index
. 그것을 발견하는 데 몇 시간이 걸렸습니다.