Question

Installing Nginx

after i add ssl ( port 80 and port 443 )i go to https://www.The example.com/ it give (Welcome to nginx! If you see this page, the nginx web server is successfully installed and working. Further configuration is required. For online documentation and support please refer to nginx.org. Commercial support is available at nginx.com. Thank you for using nginx.)

and http://www.The example.com/ go to (Success!The example .com server block is working!)

please advise

i go through https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-20-04

and https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-20-04#step-5-–-setting-up-server-blocks-(recommended)


Submit an answer

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!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi @iot,

It seems to me like you don’t have a Nginx config listening for port 443 for your domain.

Usually, Let’s Encrypt should create that automatically for you and the config should be found at /etc/nginx/sites-available. Go there and see if you can spot an SSL config for your domain theexample.com.

If you can’t create a new config following the same pattern from the https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-20-04#step-5-setting-up-server-blocks-recommended tutorial. The config should look like this:

server {
    listen              443 ssl;
    server_name         example.com www.example.com;
    root /var/www/example.com/html;
    index index.html index.htm index.nginx-debian.html;

    server_name your_domain www.your_domain;
    ssl_certificate     /path/to/SSL/CERT/www.example.com.crt;
    ssl_certificate_key  /path/to/SSL/Key/www.example.com.key;
    
    location / {
            try_files $uri $uri/ =404;
    }
}

Once you create the config, follow the other steps in the mentioned tutorial to finish the setup.