Symptoms
Nginx is failing to restart.
nginx[12345]: nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
nginx[12345]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
This happens because Apache is already using these ports.
Description
cPanel's Nginx, by default, needs to bind to ports 80 and 443, which are the same ports used by Apache. However, installing cPanel's Nginx package will change Apache to alternate ports 81 and 444. If the scripts don't run or a configuration change causes the ports to reset in Apache, it can prevent Nginx from starting correctly due to the ports already being in use. Similar problems can also happen if the log files are removed causing a service to fail or the configuration file for Apache to be reset.
Workaround
Reinstall the Nginx package in SSH/Terminal using the following commands.
- If using YUM: ( for CentOS/CloudLinux 7 Servers )
yum reinstall ea-nginx
- If using DNF: ( for AlmaLinux/Rocky/CloudLinux 8 and 9 Servers )
dnf reinstall ea-nginx
Comments
0 comments
Article is closed for comments.