Почему nginx ругается на конфликт server name?
Решил освоить nginx и перенес свои сайты на него с Apache.
Помогите, пожалуйста, разобраться почему получаю предупреждение по команде:
nginx -t
nginx: [warn] conflicting server name "" on 0.0.0.0:443, ignored nginx: [warn] conflicting server name "" on [::]:443, ignored nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful
Насколько я понимаю у меня нет пересекающихся имен сервера. Конфиг:
site1:
server { listen 80; listen [::]:80; server_name www.site1.ru site1.ru; return 301 https://$host$request_uri; } server { listen 443 ssl http2; listen [::]:443 ssl http2; include snippets/ssl-site1.ru.conf; include snippets/ssl-params.conf; autoindex off; index index.php index.html; fastcgi_index index.php; root /var/www/ipprosto.ru/html; access_log /var/www/site1.ru.access.log; error_log /var/www/site1.ru.error.log; location / { # location ~ [^/]\.ph(p\d*|tml)$ { # try_files /does_not_exists @php; # } # try_files $uri $uri/ $uri.php?$args; # index index.php index.html index.htm; try_files $uri $uri/ /index.php$is_args$args; # try_files $uri $uri/ /index.php?$args; } # location @php { # fastcgi_index index.php; # fastcgi_pass unix:/run/php/php7.0-fpm.sock; # fastcgi_split_path_info ^((?U).+\.ph(?:p\d*|tml))(/?.+)$; # try_files $uri =404; # include fastcgi_params; # } location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php7.0-fpm.sock; } location ~ /\.ht { deny all; } location = /favicon.ico { log_not_found off; access_log off; } # location = /robots.txt { # log_not_found off; # access_log off; # allow all; # } location ~* \.(css|gif|ico|jpeg|jpg|js|png)$ { expires max; log_not_found off; } location ~ /.well-known { allow all; } }
site2:
server { listen 80; listen [::]:80; server_name site2.ru; return 301 https://$server_name$request_uri; } server { listen 443 ssl http2; listen [::]:443 ssl http2; include snippets/ssl-site2.ru.conf; include snippets/ssl-params.conf; autoindex off; index index.php index.html; fastcgi_index index.php; root /var/www/site2.ru/html; access_log /var/www/site2.ru.access.log; error_log /var/www/site2.ru.error.log; location / { location ~ [^/]\.ph(p\d*|tml)$ { try_files /does_not_exists @php; } try_files $uri $uri/ $uri.php?$args; } location @php { fastcgi_index index.php; fastcgi_pass unix:/run/php/php7.0-fpm.sock; fastcgi_split_path_info ^((?U).+\.ph(?:p\d*|tml))(/?.+)$; try_files $uri =404; include fastcgi_params; } location /l/ { rewrite ^/l/([a-zA-Z0-9/]+)$ /l.php?i=$1 last; } location /t/ { rewrite ^/t/([a-zA-Z0-9/]+)$ /t.php?i=$1 last; } location /w/ { rewrite ^/w/([a-zA-Z0-9/]+)$ /w.php?i=$1 last; } location /unsubscribe/ { rewrite ^/unsubscribe/(.*)$ /unsubscribe.php?i=$1 last; } location /subscribe/ { rewrite ^/subscribe/(.*)$ /subscribe.php?i=$1 last; } location ~ /.well-known { allow all; } location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ { access_log off; log_not_found off; expires 30d; } }
default:
server { listen 80 default_server; listen [::]:80 default_server; root /var/www/html; index index.html index.htm index.nginx-debian.html; server_name _; location / { # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. try_files $uri $uri/ =404; } }
Помогите, пожалуйста, разобраться почему получаю предупреждение по команде:
nginx -t
nginx: [warn] conflicting server name "" on 0.0.0.0:443, ignored nginx: [warn] conflicting server name "" on [::]:443, ignored nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful
Насколько я понимаю у меня нет пересекающихся имен сервера. Конфиг:
site1:
server { listen 80; listen [::]:80; server_name www.site1.ru site1.ru; return 301 https://$host$request_uri; } server { listen 443 ssl http2; listen [::]:443 ssl http2; include snippets/ssl-site1.ru.conf; include snippets/ssl-params.conf; autoindex off; index index.php index.html; fastcgi_index index.php; root /var/www/ipprosto.ru/html; access_log /var/www/site1.ru.access.log; error_log /var/www/site1.ru.error.log; location / { # location ~ [^/]\.ph(p\d*|tml)$ { # try_files /does_not_exists @php; # } # try_files $uri $uri/ $uri.php?$args; # index index.php index.html index.htm; try_files $uri $uri/ /index.php$is_args$args; # try_files $uri $uri/ /index.php?$args; } # location @php { # fastcgi_index index.php; # fastcgi_pass unix:/run/php/php7.0-fpm.sock; # fastcgi_split_path_info ^((?U).+\.ph(?:p\d*|tml))(/?.+)$; # try_files $uri =404; # include fastcgi_params; # } location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php7.0-fpm.sock; } location ~ /\.ht { deny all; } location = /favicon.ico { log_not_found off; access_log off; } # location = /robots.txt { # log_not_found off; # access_log off; # allow all; # } location ~* \.(css|gif|ico|jpeg|jpg|js|png)$ { expires max; log_not_found off; } location ~ /.well-known { allow all; } }
site2:
server { listen 80; listen [::]:80; server_name site2.ru; return 301 https://$server_name$request_uri; } server { listen 443 ssl http2; listen [::]:443 ssl http2; include snippets/ssl-site2.ru.conf; include snippets/ssl-params.conf; autoindex off; index index.php index.html; fastcgi_index index.php; root /var/www/site2.ru/html; access_log /var/www/site2.ru.access.log; error_log /var/www/site2.ru.error.log; location / { location ~ [^/]\.ph(p\d*|tml)$ { try_files /does_not_exists @php; } try_files $uri $uri/ $uri.php?$args; } location @php { fastcgi_index index.php; fastcgi_pass unix:/run/php/php7.0-fpm.sock; fastcgi_split_path_info ^((?U).+\.ph(?:p\d*|tml))(/?.+)$; try_files $uri =404; include fastcgi_params; } location /l/ { rewrite ^/l/([a-zA-Z0-9/]+)$ /l.php?i=$1 last; } location /t/ { rewrite ^/t/([a-zA-Z0-9/]+)$ /t.php?i=$1 last; } location /w/ { rewrite ^/w/([a-zA-Z0-9/]+)$ /w.php?i=$1 last; } location /unsubscribe/ { rewrite ^/unsubscribe/(.*)$ /unsubscribe.php?i=$1 last; } location /subscribe/ { rewrite ^/subscribe/(.*)$ /subscribe.php?i=$1 last; } location ~ /.well-known { allow all; } location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ { access_log off; log_not_found off; expires 30d; } }
default:
server { listen 80 default_server; listen [::]:80 default_server; root /var/www/html; index index.html index.htm index.nginx-debian.html; server_name _; location / { # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. try_files $uri $uri/ =404; } }
Похожие публикации
До какого кол-ва хостов и просмотров в сутки сайт сможет работать на хостинге?
Проблемы с хостингом.
Требуется помощь (Ошибка 500)
Проблемы с Vds
Помогите с настройкой VPS
Нет комментариев