I tried to install Let’s Encrypt on my Ubuntu 20.04 by following this article: https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-20-04#step-4-%E2%80%94-obtaining-an-ssl-certificate and after installing Nginx stopped working and I can’t start Nginx anymore.
These are a few of the tests:
#sudo vim /etc/nginx/sites-enabled/mydomain
server {
server_name domain.com www.domain.com;
#sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
#sudo systemctl start nginx
Job for nginx.service failed because the control process exited with error code.
See "systemctl status nginx.service" and "journalctl -xe" for details.
#sudo ufw status
Status: inactive
and certbot
asked me: Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access. I selected to redirect. And when I visit my site without https
I get 502 Bad Gateway
and when I go with https
I get domain.com refused to connect.
Any help is appreciated and thanks in advance
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
I did
sudo fuser -k 80/tcp
and did service nginx restart and site is up again.A big thanks to @bobbyiliev
Hi there,
I could suggest first checking your Nginx error log for some more information on why the service is crashing. You can do that with the following command:
Another thing you could do is to run the
journalctl -xe
as per the output of the Nginx start command.Feel free to share the errors here. Regards, Bobby
Thanks @bobbyiliev for your reply
These are the complete outputs:
I’m really confused since it was working at first and it stopped suddenly.
Thanks in advance