Ubuntu 18.04, no virtual server setup, single website only, following directions from marketplace, closed port 80, but there was no instructions on how to force all web traffic to use https.
Any help would be appreciated.
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 won’t recommend closing port 80 just redirecting all traffic from HTTP to HTTPS.
There are a few ways to do so.
Redirect to https using .htaccess
In your website’s .htaccess you can add the following code
It should be enough to help you with the redirection.
Redirect to https using a WordPress plugin
Using a WordPress can be really easy, it will both help you redirect to HTTPS and solve the potential problem of a Mixed Content. Here are a couple of plugins you can use
Redirect to https via Nginx
If you are using Nginx, you can add the following server block
The above should be added in your website’s Nginx vhost file.
Additionally, please make sure to change example.com with your domain name.
This comment has been deleted
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.
Sign up now