Nginx is a free and open source webserver for Linux. It is newer and often easier to configure than Apache, which is why we are using it in this guide.

  1. Install nginx.
    $ sudo apt install nginx
  2. Generate a dhparams.pem.
    # cd /etc/nginx
    # openssl dhparam -out dhparams.pem 2048
  3. Configure nginx to automatically redirect http to https, and www to not www (it’s best practice to stick with one). Edit /etc/nginx/nginx.conf. Inside the http block, add a server block:
    server {
    	listen                  80;
    	listen                  [::]:80;
    	listen                  443 default_server ssl;
    	server_name   ;
    	if ($http_host = {
    		return 303$request_uri;
    	if ($scheme = http) {
    		return 301$request_uri;
    	ssl_certificate         /etc/letsencrypt/live/;
    	ssl_certificate_key     /etc/letsencrypt/live/;
    	ssl_dhparam             /etc/nginx/dhparams.pem;
    	ssl_protocols           TLSv1 TLSv1.1 TLSv1.2;
    	# The following is the current (Sept 2017) recommendation from

    Additionally, set the website root and index file, also in the http block:

    root /var/www;
    index index.html;
  4. Restart nginx so that the new configuration takes affect.
    # systemctl restart nginx.service
  5. You’ll run into trouble when trying to upgrade Let’s Encrypt certificates in your cron job because certbot needs to bind to port 80 for the renewal process. Modify your crontab so that the executed command looks like this:
    certbot renew --pre-hook "systemctl stop nginx" --post-hook "systemctl start nginx"
  6. Visit SSL Labs and test the security of your server. Fix any vulnerabilities it finds.
  7. Create a website! Use whatever tools you are comfortable with. This site was generated using jekyll, which basically turns markdown files (generated by you) and formatting (available online) into a static HTML website. I found that, after a brief (1 hour) learning curve, nealy 100% of my energies are now spent on content creation rather than fighting with the technologies. If you need further inspiration, you can find the source for this website on Github.