...
Follow the instructions here up to Step 7: https://certbot.eff.org/instructions?ws=nginx&os=ubuntubionic. In Step 7, run the first command: sudo certbot --nginx
- the final step of this (installing the certificate into NGINX) will fail. Continuing with the instructions here will install the certificate manually.
Configure NGINX
Run
sudo rm mv /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf
to remove.bak
to create a default copy of the default configuration.Run
sudo vim /etc/nginx/conf.d/phixflow.conf
and paste in the following, replacing[subdomain]
with the appropriate subdomain of the server:Code Block server { listen 443 ssl; listen [::]:443 ssl ipv6only=on; server_name [subdomain].phixflow.com; proxy_intercept_errors on; error_page 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 421 422 423 424 425 426 428 429 431 451 500 501 502 503 504 505 506 507 508 510 511 /custom_error.html; location = /custom_error.html { internal; root /usr/share/nginx/html; } location / { proxy_pass http://127.0.0.1:8080; } ssl_certificate /etc/letsencrypt/live/[subdomain].phixflow.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/[subdomain].phixflow.com/privkey.pem; include /etc/letsencrypt/options-ssl-nginx.conf; ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; client_max_body_size 40M; add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"; }
Create custom error page
Create a file
/usr/share/nginx/html/custom_error.html
, e.g.sudo nano /usr/share/nginx/html/custom_error.html
, and enter the following contents:
...