I created an EC2 Instance and deployed a website on it. It was working fine. There was only a minor issue with 'upload_max_filesize' value, which was 5M in php.ini though 2M as per phpinfo(). I decided to reboot the server, in the hope that this value would get fixed. However, after reboot, the site stopped working completed with a message:
This site can’t be reached
silkweb.ca refused to connect.
Try:
Checking the connection
Checking the proxy and the firewall
ERR_CONNECTION_REFUSED
My EC2 instance is running fine. I don't see any errors in system log.
Any idea: how to fix this issue?
Update: On checking, I have found out that the nginx service is not running
This does not get fixed even after rebooting. (And it was working fine before the first reboot)
ubuntu@ip-172-31-35-96:~$ sudo systemctl status nginx
× nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2023-04-26 19:27:27 UTC; 2min 31s ago
Docs: man:nginx(8)
CPU: 66ms
Apr 26 19:27:26 ip-172-31-35-96 nginx[520]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Unknown error)
Apr 26 19:27:26 ip-172-31-35-96 nginx[520]: nginx: [emerg] bind() to [::]:80 failed (98: Unknown error)
Apr 26 19:27:26 ip-172-31-35-96 nginx[520]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Unknown error)
Apr 26 19:27:26 ip-172-31-35-96 nginx[520]: nginx: [emerg] bind() to [::]:80 failed (98: Unknown error)
Apr 26 19:27:27 ip-172-31-35-96 nginx[520]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Unknown error)
Apr 26 19:27:27 ip-172-31-35-96 nginx[520]: nginx: [emerg] bind() to [::]:80 failed (98: Unknown error)
Apr 26 19:27:27 ip-172-31-35-96 nginx[520]: nginx: [emerg] still could not bind()
Apr 26 19:27:27 ip-172-31-35-96 systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
Apr 26 19:27:27 ip-172-31-35-96 systemd[1]: nginx.service: Failed with result 'exit-code'.
Apr 26 19:27:27 ip-172-31-35-96 systemd[1]: Failed to start A high performance web server and a reverse proxy server.
I am using Elastic IP. Looks like some change is somehow causing nginx service to not start properly.