nginx.conf

Notes on how to configure HTTPS/SSL with Nginx (on a Linode Ubuntu server)

Table of Contents1 - Summary2 - New Linode Server3 - Update Everything4 - Ubuntu Firewall5 - Add a New User6 - Disabling Root Login (sshd_config)7 - Limit Login Attempts (sshd_config)8 - Install Nginx and MySQL9 - Adjust Firewall10 - Nginx Configuration11 - Installing Java on Ubuntu12 - NOT what I used: Let’s Encrypt on Ubuntu 16.0413 - (1) Create a cert (openssl)14 - (2) Create a strong Diffie-Hellman group15 - (3) Configure Nginx to Use SSL16 - Adjust the Nginx Configuration to Use SSL17 - (Alternative Configuration) Allow Both HTTP and HTTPS Traffic18 - Adjust the Firewall19 - Enable the Changes in Nginx20 - Test in Browser21 - Nginx "default_server"22 - Can change to a permanent redirect (301)23 - More Security: Preventing Information Disclosure24 - More Security: Fail2Ban25 - Restricting Access by IP Address26 - See also

Without any introduction or discussion, here are the notes I made while learning how to get HTTPS working with Nginx. These are just for me, but if something helps you, cool.

Nginx 301 redirect examples

Here's an example of how to do a 301 Redirect with Nginx:

rewrite /blog/Content/2/8/581 /blog/post/java/dos-batch-files-compile-run-java-program-create-jar-file permanent;

As you can see, Nginx uses the keyword permanent instead of 301.

I just did a few hundred of these on this devdaily.com website. I put them in a separate "redirects.conf" file, and included that file into my main nginx.conf file like this: