D
D
Dmitry Shvedchenko2015-06-02 12:53:09
linux
Dmitry Shvedchenko, 2015-06-02 12:53:09

NGINX - conflicting server name "sub.domain.com" on 0.0.0.0:80, ignored - how to fix?

Hello dear community!
Please tell me how to fix the NGINXa error:

NGINX - conflicting server name "sub.domain.com" on 0.0.0.0:80, ignored

domain.com in the wirt.host config, I redirect to https.
server {
server_name domain.com;
listen 80;
return 301 https://www.domain.com$request_uri;
}
server {
listen 80;
listen 443 ssl spdy;
server_name www.domain.com
keepalive_timeout 70;
error_log /var/log/nginx/domain-errors.log;
access_log /var/log/nginx/domain-access.log;
root /srv/www/domain.com/;
index index.php;
ssl on;
#ssl_certificate /etc/nginx/ssl/domain.com/www.domain.com.crt;
ssl_certificate /etc/nginx/ssl/domain.com/www.domain.com.pem;
ssl_certificate_key /etc/nginx/ssl/domain.com/www.domain.com.key;
ssl_dhparam /etc/nginx/ssl/dhparam.pem;
#ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_protocols TLSv1.1 TLSv1.2;
#ssl_ciphers ALL:!ADH:!EXP:!LOW:!RC2:!3DES:!SEED:!RC4:+HIGH:+MEDIUM;
#ssl_ciphers EECDH+ECDSA+AESGCM:AES128+EECDH:AES128+EDH:!RC4:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS:!CAMELLIA:! ADH;
ssl_ciphers kEECDH+AESGCM+AES128:kEECDH+AES128:kRSA+AESGCM+AES128:kRSA+AES128:!RC4:!aNULL:!eNULL:!MD5:!EXPORT:!LOW:!SEED:!CAMELLIA:!IDEA:!PSK :!SRP:!SSLv2;
ssl_prefer_server_ciphers on;
ssl_stapling on;
ssl_stapling_verify on;
add_header Content-Security-Policy-Report-Only "default-src https:; script-src https: 'unsafe-eval' 'unsafe-inline'; style-src https: 'unsafe-inline'; img-src https: data :: font-src https: data:; report-uri /csp-report";
#resolver 8.8.8.8 8.8.4.4 valid=300s;
resolver 127.0.0.1;
resolver_timeout 10s;
# config to enable HSTS(HTTP Strict Transport Security) to avoid ssl stripping https://en.wikipedia.org/wiki/SSL_stripping#SSL_st...
add_header Strict-Transport-Security "max-age=31536000";
location / {
# Front Controller Pattern
# Roundcube doesn't require the query string /index.php?q=$uri&$args,
try_files $uri $uri/ /index.php;
#auth_basic "Restricted"; #For Basic Auth
#auth_basic_user_file /etc/nginx/.htpasswd; #For Basic Auth
}
# Deny access to the following files
location ~ ^/(README.md|INSTALL|LICENSE|CHANGELOG|UPGRADING)$ {
deny all;
}
# Deny access to the following directories
location ~ ^/(config|temp|logs)/ {
deny all;
}
# Deny access to hidden/important files eg: .htaccess .htpasswd
location ~ /\. {
access_log off;
log_not_found off;
deny all;
}
location = /favicon.ico {
access_log off;
log_not_found off;
}
location ~* \.(?:v|s|css|js|jp?g|gif|png|ico|mp3|wav|swf)$ {
expires 1y;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
fastcgi_hide_header Set-Cookie;
access_logoff;
}
# Pass the PHP scripts to FastCGI server (locally with unix: param to avoid network overhead)
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/tmp/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}

here is the config of the subdomain on which it swears in the log:
server {
server_name webmail.domain.com;
listen 80;
return 301 https://webmail.domain.com$request_uri;
}
server {
listen 80;
listen 443 ssl spdy;
server_name webmail.domain.com;
keepalive_timeout 70;
error_log /var/log/nginx/roundcube-errors.log;
access_log /var/log/nginx/roundcube-access.log;
root /srv/www/roundcube/;
index index.php;
ssl on;
#ssl_certificate /etc/nginx/ssl/webmail/webmail.domain.com.crt;
ssl_certificate /etc/nginx/ssl/webmail/webmail.domain.com.pem;
ssl_certificate_key /etc/nginx/ssl/webmail/webmail.domain.com.key;
ssl_dhparam /etc/nginx/ssl/dhparam.pem;
#ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_protocols TLSv1.1 TLSv1.2;
#ssl_ciphers ALL:!ADH:!EXP:!LOW:!RC2:!3DES:!SEED:!RC4:+HIGH:+MEDIUM;
ssl_ciphers EECDH+ECDSA+AESGCM:AES128+EECDH:AES128+EDH:!RC4:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS:!CAMELLIA:!ADH ;
ssl_prefer_server_ciphers on;
ssl_stapling on;
ssl_stapling_verify on;
add_header Content-Security-Policy-Report-Only "default-src https:; script-src https: 'unsafe-eval' 'unsafe-inline'; style-src https: 'unsafe-inline'; img-src https: data :: font-src https: data:; report-uri /csp-report";
#resolver 8.8.8.8 8.8.4.4 valid=300s;
resolver 127.0.0.1;
resolver_timeout 10s;
# config to enable HSTS(HTTP Strict Transport Security) to avoid ssl stripping https://en.wikipedia.org/wiki/SSL_stripping#SSL_st...
add_header Strict-Transport-Security "max-age=31536000";
location / {
# Front Controller Pattern
# Roundcube doesn't require the query string /index.php?q=$uri&$args,
try_files $uri $uri/ /index.php;
auth_basic "Restricted"; #For Basic Auth
auth_basic_user_file /etc/nginx/.htpasswd; #For Basic Auth
}
# Deny access to the following files
location ~ ^/(README.md|INSTALL|LICENSE|CHANGELOG|UPGRADING)$ {
deny all;
}
# Deny access to the following directories
location ~ ^/(config|temp|logs)/ {
deny all;
}
# Deny access to hidden/important files eg: .htaccess .htpasswd
location ~ /\. {
access_log off;
log_not_found off;
deny all;
}
location = /favicon.ico {
access_log off;
log_not_found off;
}
location ~* \.(?:v|s|css|js|jp?g|gif|png|ico|mp3|wav|swf)$ {
expires 1y;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
fastcgi_hide_header Set-Cookie;
access_logoff;
}
# Pass the PHP scripts to FastCGI server (locally with unix: param to avoid network overhead)
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/tmp/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}

and another subdomain with the same config...
Tell me please, where is the mistake?
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sim3x, 2015-06-02
@kbu

server {

# listen 80; не нужно сулшать не https порт
listen 443 ssl spdy;

server_name webmail.domain.com;

you need to cut the regular season - specify all existing names
server_name "~^(^webmail|www)\.domain\.com$";

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question