I have been following the NGINX SSL with Let’s Encrypt tutorial and appear to have successfully configured SSL for my server, but it doesn’t appear to default to that. When I access my website with www.mysite.com
it defaults to http, but if I use https://www.mysite.com
, I am able to access the server, but it displays the NGINX server landing page (“Welcome to nginx!”) page on an initially created server. I followed the instructions outside of the ufw
firewall setup, but I was wondering if that could actually be related to this problem or if a scenario like this would be related the NGINX server configuration. Can anyone provide some guidance?
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.
Here’s a new config for http to https redirect:
#This server block will redirect http:// to https://www.mysite.com
server {
listen 80;
listen [::]:80;
server_name mysite.com www.mysite.com;
return 301 https://www.mysite.com$request_uri;
}
#This server block will redirect https://mysite.com to https://www.mysite.com (expecting that you have a certificate for mysite.com as well as www.mysite.com
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
include snippets/ssl-www.mysite.com.conf;
include snippets/ssl-params.conf;
server_name mysite.com;
return 301 https://www.$server_name$request_uri;
}
#This is the server block actually delivering content to the visitor
server {
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;
include snippets/ssl-www.mysite.com.conf;
include snippets/ssl-params.conf;
server_name www.mysite.com;
client_max_body_size 100M;
location ~ ^/\.well-known {
root /var/www/ghost;
allow all;
}
location / {
proxy_pass http://127.0.0.1:2368;
proxy_buffering off;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Referer "";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_http_version 1.1;
}
}
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, I’m having the same problem but I’m not getting anywhere. The https site still shows the nginx webpage. :(
Here’s my nginx config (with stuff that was added by Certbot):
I think this could help https://www.digitalocean.com/community/tutorials/how-to-deploy-a-laravel-application-with-nginx-on-ubuntu-16-04?utm_medium=social&utm_source=twitter&utm_campaign=laravel_deploy_tut&utm_content=no_image#step-6-—-securing-your-application-with-tls