Symptoms
-
The following error is present on the Domains > example.com page:
nginx: [emerg] bind() to 203.0.113.2:443 failed (99: Cannot assign requested address) nginx: configuration file /etc/nginx/nginx.conf test failed
-
It is not possible to enable nginx service or reconfigure domains using
plesk repair web
:ERR [panel] Apache config (14299906990.63406700) generation failed: Template_Exception: nginx: [emerg] bind() to 203.0.113.2:80 failed (99: Cannot assign requested address)
- The IP address from the error message is marked as not configured properly under Tools & Settings > IP Addresses or is not present there at all.
Cause
The IP address from the error message was removed from the server but still present in Plesk database.
Resolution
-
Connect to the server via SSH.
-
Make sure that no domains are assigned to the IP address from the error message:
Note: change the "203.0.113.2" IP address in the command below to the correct one based on the error message.
# plesk db "SELECT DISTINCT d.name, GROUP_CONCAT(DISTINCT(IF(ip.public_ip_address IS NULL, ip.IP_Address, ip.public_ip_address)) SEPARATOR ', ') AS IPs FROM domains d JOIN DomainServices ds ON d.id=ds.dom_id JOIN IpAddressesCollections ipc USING(ipCollectionId) JOIN IP_Addresses ip ON ipc.ipAddressId=ip.id RIGHT JOIN Subscriptions s on s.object_id=d.id WHERE d.id IS NOT NULL GROUP BY d.name;" | grep "203.0.113.2"
If any domains were returned during the command execution:
| example.com | 203.0.113.2 |
| example.org | 203.0.113.2 |change the IP address for these domains to the existing one.
-
Make sure that the affected IP address does not exist on the server:
Note: change the "203.0.113.2" IP address in the command below to the correct one based on the error message.
# ip a | grep "203.0.113.2"
-
Go to Tools & Settings > IP Addresses and remove the affected IP address if it is still present there.
-
Via the SSH, re-enable nginx:
# plesk sbin nginxmng -d
# plesk sbin nginxmng -e