• The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Resolved Nginx: [emerg] a duplicate default server

georgee

New Pleskian
Hello
I have encountered a problem when changing the IP server

"New configuration files for the Apache web server were not created due to the errors in configuration templates: nginx: [emerg] a duplicate default server for 192.168.122.100:443 in /etc/nginx/plesk.conf.d/ip_default/inetpv.cz.conf:7 nginx: configuration file /etc/nginx/nginx.conf test failed. Search in KB"

see picture

IP 192.168.122.100:443 not in conf

inetpv.cz.conf

#ATTENTION!
#
#DO NOT MODIFY THIS FILE BECAUSE IT WAS GENERATED AUTOMATICALLY,
#SO ALL YOUR CHANGES WILL BE LOST THE NEXT TIME THE FILE IS GENERATED.

server {
listen 192.168.111.100:443 default_server ssl http2;

server_name inetpv.cz;
server_name www.inetpv.cz;
server_name ipv4.inetpv.cz;
server_name inetpv.eu;
server_name www.inetpv.eu;

ssl_certificate /opt/psa/var/certificates/cert-bZPPoP;
ssl_certificate_key /opt/psa/var/certificates/cert-bZPPoP;
ssl_client_certificate /opt/psa/var/certificates/cert-mzfb7L;

client_max_body_size 128m;

root "/var/www/vhosts/inetpv.cz/httpdocs";
access_log "/var/www/vhosts/system/inetpv.cz/logs/proxy_access_ssl_log";
error_log "/var/www/vhosts/system/inetpv.cz/logs/proxy_error_log";

location ^~ /plesk-site-preview/ {
proxy_pass http://127.0.0.1:8880;
proxy_set_header Host plesk-site-preview.local;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_cookie_domain plesk-site-preview.local $host;
access_log off;
}

if ($host ~* ^inetpv\.cz$) {
rewrite ^(.*)$ https://www.inetpv.cz$1 permanent;
}
if ($host ~* ^inetpv\.eu$) {
rewrite ^(.*)$ https://www.inetpv.cz$1 permanent;
}
if ($host ~* ^www\.inetpv\.eu$) {
rewrite ^(.*)$ https://www.inetpv.cz$1 permanent;
}

location / {
proxy_pass https://192.168.111.100:7081;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Accel-Internal /internal-nginx-static-location;
access_log off;
}

location /internal-nginx-static-location/ {
alias /var/www/vhosts/inetpv.cz/httpdocs/;
internal;
}

location ~ ^/(plesk-stat|awstats-icon|webstat|webstat-ssl|ftpstat|anon_ftpstat) {
proxy_pass https://192.168.111.100:7081;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Accel-Internal /internal-nginx-static-location;
access_log off;
}

location ~ ^/files/ {
proxy_pass https://192.168.111.100:7081;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Accel-Internal /internal-nginx-static-location;
access_log off;
}

add_header X-Powered-By PleskLin;

}

server {
listen 192.168.111.100:80 default_server;

server_name inetpv.cz;
server_name www.inetpv.cz;
server_name ipv4.inetpv.cz;
server_name inetpv.eu;
server_name www.inetpv.eu;

client_max_body_size 128m;

if ($host ~* ^inetpv\.cz$) {
return 301 https://www.$host$request_uri;
}
return 301 https://$host$request_uri;


Thank you for your help
 

Attachments

  • plesk1.PNG
    plesk1.PNG
    384.6 KB · Views: 10
Last edited:
Hi georgee,

in case that you experience issues as described, pls. delete the old corresponding configuration files and replace the "/etc/nginx/nginx.conf" with the one from your vendor package. Afterwards let the Plesk Repair Utility build new configuration files.

Example commands:
Code:
rm /etc/nginx/plesk.conf.d/ip_default/inetpv.cz.conf

cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf_old
cp /etc/nginx/nginx.conf.dpkg-dist /etc/nginx/nginx.conf

plesk repair web -y -v
 
The procedure did not help to fix it

root@inetpv:~# rm /etc/nginx/plesk.conf.d/ip_default/inetpv.cz.conf
root@inetpv:~# cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf_old
root@inetpv:~# cp /etc/nginx/nginx.conf.dpkg-dist /etc/nginx/nginx.conf
cp: cannot stat '/etc/nginx/nginx.conf.dpkg-dist': No such file or directory
root@inetpv:~# plesk repair web -y -v

Checking Plesk version
Installed Plesk version/build: 17.5.3 Ubuntu 16.04 1705170317.16

Checking for custom configuration templates ......................... [OK]

Checking for the JkWorkersFile directive in the Apache configuration [OK]

Checking associations between domains and IP addresses .............. [OK]

Checking for corrupted reference between IP collections and IP
addresses ........................................................... [OK]

Checking for links between APS applications and subscriptions ....... [OK]

Checking for the Zend extension declaraion in php.ini ............... [OK]

Check symbolic links for latest virtual host config files ........... [OK]

Checking for system users home directories consistency .............. [OK]

Checking for records with empty name field in the Configurations table[OK]

Checking for nginx ULIMIT value ..................................... [OK]

Checking for extra configurations in database not owned by any object [OK]

Repairing web server configuration
Reinstalling SSL/TLS certificates ............................... [OK]
Applying the default SSL/TLS certificate to all IP addresses .... [OK]
Repairing server-wide configuration parameters for web servers .. [OK]
Updating the file of sharing passwords and permissions of users
according to actual information ................................. [OK]
Repairing web server configuration for all domains. This aspect
can be used with individual domains ("plesk repair web
example.com"), and on the server level ("plesk repair web") ..... [OK]

Checking the usage of PHP handlers .................................. [OK]

Error messages: 0; Warnings: 0; Errors resolved: 0


The error still appears

Error: New configuration files for the Apache web server were not created due to the errors in configuration templates: nginx: [emerg] a duplicate default server for 192.168.122.100:443 in /etc/nginx/plesk.conf.d/ip_default/inetpv.cz.conf:7 nginx: configuration file /etc/nginx/nginx.conf test failed. Search in KB
 
Hi georgee,

you missed the fact, that you didn't restore a "fresh" /etc/nginx/nginx.conf, as you can see:
root@inetpv:~# cp /etc/nginx/nginx.conf.dpkg-dist /etc/nginx/nginx.conf
cp: cannot stat '/etc/nginx/nginx.conf.dpkg-dist': No such file or directory

Pls. post your file "/etc/nginx/nginx.conf" as attachment, so that we are able to help you to correct misconfigurations.
 
I did not change anything in the configuration.
Just IP.

Thx
 

Attachments

  • nginx.conf.txt
    980 bytes · Views: 5
Hi georgee,

could you pls. post the output of the following find - commands?
Code:
find /etc/nginx -type f -name "*.conf" -exec grep --color -Hni "default_server" {} \;
and
Code:
find /var/www/vhosts/system/*/conf -type f -name "*.conf" -exec grep --color -Hni "default_server" {} \;
 
root@inetpv:~# find /etc/nginx -type f -name "*.conf" -exec grep --color -Hni "default_server" {} \;
root@inetpv:~#
root@inetpv:~#
root@inetpv:~#
root@inetpv:~# find /var/www/vhosts/system/*/conf -type f -name "*.conf" -exec grep --color -Hni "default_server" {} \;
/var/www/vhosts/system/inetpv.cz/conf/nginx_ip_default.conf:7: listen 192.168.111.100:443 default_server ssl http2;
/var/www/vhosts/system/inetpv.cz/conf/nginx_ip_default.conf:81: listen 192.168.111.100:80 default_server;
root@inetpv:~#
plesk2.PNG
 
First I made a change IP address through SSH server. Plesk /etc/network/interfaces na IP 192.168.111.100 etc.
Than I logged in through https://192.168.111.100:8443 as an administrator.
In Tools & Settings / IP Addresses I made Reread IP. New IP address was displayed here: 192.168.111.100/255.255.255.0. I made EDIT and added Public IP address xxx.xxx.xxx.xxx.
After this changing I inverted access in Domains Web Hosting inetpv.cz IP address xxx.xxx.xxx.xxx. and I saved.
Than I went back to Tools & Settings / IP Addresses and removed IP 192.168.122.100/255.255.255.0.
In the item HOME showed it the notice that the chance of NGINX went through and the system asked me if I want correct it and I answered yes.
It´s all that I made it.
 
Thank you
I did according to the instructions
root@inetpv:~# MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -Ns -uadmin -D psa -e 'select name from domains' | awk '{print "/usr/local/psa/bin/domain --update " $1 " -ip 192.168.111.100 "}' | sh
SUCCESS: Update of domain 'aaaaa.eu' completed.
SUCCESS: Update of domain 'bbbbb.cz' completed.
SUCCESS: Update of domain 'cccccc.cz' completed.
SUCCESS: Update of domain 'dddddd.cz' completed.
root@inetpv:~# /usr/local/psa/bin/reconfigurator.pl ipaddresses.map
mysql: [Warning] Using a password on the command line interface can be insecure.
192.168.111.100: address is already used by Plesk
ipaddresses.map: 1 conflicts found
root@inetpv:~# /usr/local/psa/bin/reconfigurator.pl ipaddresses.map
mysql: [Warning] Using a password on the command line interface can be insecure.
192.168.122.100: address is not used by Plesk
192.168.111.100: address is already used by Plesk
ipaddresses.map: 2 conflicts found
root@inetpv:~# /usr/local/psa/bin/reconfigurator.pl ipaddresses.map
mysql: [Warning] Using a password on the command line interface can be insecure.
192.168.122.100: address is not used by Plesk
192.168.111.100: address is already used by Plesk
ipaddresses.map: 2 conflicts found
root@inetpv:~# /usr/local/psa/bin/repair -r
-- Restoring DNS server configuration... started.

Restoring DNS server configuration

Synchronize DNS zones with the DNS server? [Y/n] Y
Synchronizing DNS zones with the DNS server ..................... [OK]
-- Restoring DNS server configuration... done: Ok
-- Restoring mail server configuration... started.
==> Checking for: mailsrv_conf_init... ok
==> Checking for: mail_handlers_init... ok
==> Checking for: mailsrv_entities_dump... ok
==> Checking for: mail_admin_aliases... ok
==> Checking for: mail_auth_dump... ok
==> Checking for: mailman_lists_dump... ok
==> Checking for: mail_kav8_restore... ok
==> Checking for: mail_responder_restore... ok
==> Checking for: mail_imap_restore... ok
==> Checking for: mail_spam_restore... ok
==> Checking for: mail_grey_restore... ok
==> Checking for: mail_mailbox_restore... ok
==> Checking for: mail_spf_restore... ok
==> Checking for: mail_dk_restore... ok
==> Checking for: mail_dmarc_restore... ok
==> Checking for: mail_drweb_restore... ok
==> Checking for: mail_outgoing_restore... ok
==> Checking for: mail_transport_restore... ok
-- Restoring mail server configuration... done: Ok
-- Restoring web server configuration... started.
-- Restoring web server configuration... done: Ok
SUCCESS: The configuration files were successfully restored.
root@inetpv:~# plesk bin reconfigurator --autoconfigure
mysql: [Warning] Using a password on the command line interface can be insecure.
Database: [<192.168.111.100>]
Actual: [<172.17.0.1>, <192.168.111.100>]
Removed IPs: [] []
Added IPs: [<172.17.0.1>] []
Mapping: {}
Old not remapped: []
New not used: [<172.17.0.1>]
Nothing to do.
root@inetpv:~#

Is everything okay?

However, the Webserver Configurations Troubleshooter shows an error

New configuration files for the Apache web server were not created due to the errors in configuration templates: nginx: [emerging] and duplicate default server for 192.168.122.100:443 in /etc/nginx/plesk.conf.d/ip_default/inetpv. Cz.conf: 7 nginx: configuration file /etc/nginx/nginx.conf test failed. Search in KB
 
Hi georgee,

However, the Webserver Troubleshooter shows an error
Pls. remember the previous given suggestions and pls. keep in mind, that you have as well the choice to use the "Plesk Repair Utility" with different options:


Example commands:
Code:
plesk repair all -y -v

Code:
plesk repair web -y -v

Code:
plesk repair db -y -v
 
Last edited by a moderator:
Nothing helped.
The bug was still happening

I've done a new install of the Plesk system and moved the sites to a new system
That's how I solved my problem.

Once again, I thank you for your help
 
Back
Top