Question

Site not showing on http but showing on https

Hello team,

When I enter my site URL it is showing 404 Not Found nginx/1.18.0 (Ubuntu).

I want to redirect my site HTTP to HTTPS on Nginx server can you help me regarding this issue?


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 there,

It sounds like that your Nginx server block for port 80 is missing. You can add the following Ngin server block with a 301 redirect to achieve the HTTP to HTTPS redirection:

server {
    listen 80;
    server_name www.domain.com domain.com;

    # redirects both www and non-www to https
    return 301 https://domain.com$request_uri;
}

I’ve also noticed that your website is already working as expected, if you are not seeing the correct results, make sure to clear your browser history.

Hope that this helps! Best, Bobby