Question

Site not showing on http but showing on https

Posted October 12, 2021 65 views
NginxUbuntuWordPressDigitalOceanConfiguration Management

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?

edited by bobbyiliev

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.

×
Submit an Answer
1 answer

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