My Website stopped working after I rebooted the EC 2 instance

0

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.
gefragt vor einem Jahr341 Aufrufe
2 Antworten
0

Create and assign an Elastic IP to the instance and then update your DNS to use this IP address.

profile pictureAWS
EXPERTE
kentrad
beantwortet vor einem Jahr
  • I am using Elastic IP. Looks like some change is somehow causing nginx service to not start properly.

0

Not an AWS issue, but use nginx -t to sanity-check your nginx.conf (and any other configuration files), and if it finds any errors it should tell you the location in the file where error occurs.

profile picture
EXPERTE
Steve_M
beantwortet vor einem Jahr
  • Thanks for your input. As I needed my website up and running ASAP, I ended up launching a new EC2 instance and did set up my website on the new server, which is running fine. The nginx -t command is now telling that everything is OK. I will use this command if I encounter the same issue again. Thanks again for your help.

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen