T
T
time_is_always_against_us2017-11-14 19:06:15
Nginx
time_is_always_against_us, 2017-11-14 19:06:15

"nginx: [warn] conflicting server name" - how to fix?

The site was installed using ISPManager.
Manually, I did not change any Apache settings, Nginx.
But there were problems with caching. I found a solution on the Internet - add the nginx file for the site to the conf: add_header Cache-Control "max-age=2592000, public";
Added. Helped. I went to bed with peace of mind. In the morning, caching did not work. I thought it was a small glitch, so I decided to restart nginx. To which he issued:

nginx: [warn] conflicting server name "domain.ru" on SEVER_IP:80, ignored                                                                                            
nginx: [warn] conflicting server name "www.domain.ru" on SEVER_IP:80, ignored                                                                                        
nginx: [warn] conflicting server name "domain.ru" on [2a0***::2]:80, ignored                                                                                   
nginx: [warn] conflicting server name "www.domain.ru" on [2a0***::2]:80, ignored                                                                               
nginx: [warn] conflicting server name "domain.ru" on SEVER_IP:443, ignored                                                                                           
nginx: [warn] conflicting server name "www.domain.ru" on SEVER_IP:443, ignored                                                                                       
nginx: [warn] conflicting server name "domain.ru" on [2a0***::2]:443, ignored                                                                                  
nginx: [warn] conflicting server name "www.domain.ru" on [2a0***::2]:443, ignored

Nginx settings (ISPmanager: Domains -> WWW domains -> Config):
server {
  server_name domain.ru www.domain.ru;
  charset off;
  index index.html index.php;
  disable_symlinks if_not_owner from=$root_path;
  include /etc/nginx/vhosts-includes/*.conf;
  include /etc/nginx/vhosts-resources/domain.ru/*.conf;
  access_log /var/www/httpd-logs/domain.ru.access.log;
  error_log /var/www/httpd-logs/domain.ru.error.log notice;
  set $root_path /var/www/www-root/data/www/domain.ru;
  root $root_path;
  location / {
    location ~ [^/]\.ph(p\d*|tml)$ {
      try_files /does_not_exists @fallback;
    }
    location / {
      try_files /does_not_exists @fallback;
    }
    location ~* ^.+\.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar|swf)$ {
      try_files $uri $uri/ @fallback;
      expires 30d;
      add_header Cache-Control "max-age=2592000,  public";
    }
  }
  location @fallback {
    proxy_pass http://127.0.0.1:8080;
    proxy_redirect http://127.0.0.1:8080 /;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Forwarded-Port $server_port;
    access_log off;
  }
  return 301 https://$host:443$request_uri;
  listen SEVER_IP:80;
  listen [2a0***::2]:80;
  gzip on;
  gzip_comp_level 5;
  gzip_disable "msie6";
  gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript;
}
server {
  server_name domain.ru www.domain.ru;
  ssl on;
  ssl_certificate "/var/www/httpd-cert/www-root/domain.ru.crtca";
  ssl_certificate_key "/var/www/httpd-cert/www-root/domain.ru.key";
  ssl_ciphers EECDH:+AES256:-3DES:RSA+AES:RSA+3DES:!NULL:!RC4:!RSA+3DES;
  ssl_prefer_server_ciphers on;
  ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  add_header Strict-Transport-Security "max-age=31536000;";
  ssl_dhparam /etc/ssl/certs/dhparam4096.pem;
  charset off;
  index index.html index.php;
  disable_symlinks if_not_owner from=$root_path;
  include /etc/nginx/vhosts-includes/*.conf;
  include /etc/nginx/vhosts-resources/domain.ru/*.conf;
  access_log /var/www/httpd-logs/domain.ru.access.log;
  error_log /var/www/httpd-logs/domain.ru.error.log notice;
  set $root_path /var/www/www-root/data/www/domain.ru;
  root $root_path;
  listen SEVER_IP:443;
  listen [2a0***::2]:443;
  location / {
    location ~ [^/]\.ph(p\d*|tml)$ {
      try_files /does_not_exists @fallback;
    }
    location / {
      try_files /does_not_exists @fallback;
    }
    location ~* ^.+\.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar|swf)$ {
      try_files $uri $uri/ @fallback;
      expires 30d;
      add_header Cache-Control "max-age=2592000,  public";
    }
  }
  location @fallback {
    proxy_pass http://127.0.0.1:8080;
    proxy_redirect http://127.0.0.1:8080 /;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Forwarded-Port $server_port;
    access_log off;
  }
  gzip on;
  gzip_comp_level 5;
  gzip_disable "msie6";
  gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript;
}

<VirtualHost 127.0.0.1:8080>
  ServerName domain.ru
  DocumentRoot /var/www/www-root/data/www/domain.ru
  ServerAdmin [email protected]
  AddDefaultCharset off
  SuexecUserGroup www-root www-root
  CustomLog /var/www/httpd-logs/domain.ru.access.log combined
  ErrorLog /var/www/httpd-logs/domain.ru.error.log
  <FilesMatch "\.ph(p[3-5]?|tml)$">
    SetHandler application/x-httpd-php
  </FilesMatch>
  <FilesMatch "\.phps$">
    SetHandler application/x-httpd-php-source
  </FilesMatch>
  <IfModule php5_module>
    php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -f [email protected]"
    php_admin_value upload_tmp_dir "/var/www/www-root/data/mod-tmp"
    php_admin_value session.save_path "/var/www/www-root/data/mod-tmp"
    php_admin_value open_basedir "/var/www/www-root/data:."
  </IfModule>
  <IfModule php7_module>
    php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -f [email protected]"
    php_admin_value upload_tmp_dir "/var/www/www-root/data/mod-tmp"
    php_admin_value session.save_path "/var/www/www-root/data/mod-tmp"
    php_admin_value open_basedir "/var/www/www-root/data:."
  </IfModule>
  SetEnvIf X-Forwarded-Proto https HTTPS=on
  Alias /img "/var/www/www-root/data/img"
    Alias /pma "/var/www/www-root/data/pma"
  ServerAlias www.domain.ru
  DirectoryIndex index.html index.php
</VirtualHost>
<Directory /var/www/www-root/data/www/domain.ru>
  Options -ExecCGI
  <IfModule php5_module>
    php_admin_flag engine on
  </IfModule>
  <IfModule php7_module>
    php_admin_flag engine on
  </IfModule>
</Directory>
<Directory /var/www/www-root/data/pma>
  php_admin_flag engine on
</Directory>

I tried google. It seems to be connected with the fact that the settings are duplicated, but I did not find any duplicates. The only place where these settings seem to be is: /etc/nginx/vhosts/www-root/doman.ru.conf. And it's a bit strange that it initially worked.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Arman, 2017-11-14
@time_is_always_against_us

Did you leave a copy of the config? it is very similar as if two files are connected, the first one has your edits, the second one does not.

R
rinokonli, 2017-11-14
@rinokonli

you have duplicates - remove duplicates server_name

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question