From bee4f25e2d2116068358fe3f1dd3a9899f32d02f Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Sun, 20 Feb 2022 03:59:36 -0500 Subject: [PATCH] Local Dev SSL instructions for Linux (they work!) --- localdev/nginx-http-config/storyteller-ssl | 31 +++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/localdev/nginx-http-config/storyteller-ssl b/localdev/nginx-http-config/storyteller-ssl index 886b5fc264..305753808b 100644 --- a/localdev/nginx-http-config/storyteller-ssl +++ b/localdev/nginx-http-config/storyteller-ssl @@ -4,6 +4,10 @@ # # - /etc/nginx/sites-enabled/{name-of-site} # +# Move this file there, and then restart with, +# +# sudo service nginx restart +# # On Mac, this is located at the following locations: # # - /opt/homebrew/etc/nginx/servers/{name-of-site} (for nginx installed with homebrew) @@ -18,7 +22,17 @@ # ================ # SSL Instructions # ================ -# +# +# To create self-signed certs on Ubuntu Linux, +# +# sudo apt-get install openssl +# +# sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/localhost.key -out /etc/ssl/certs/localhost.crt +# +# ^ most fields can be blank, but the "Common Name" should be `*.jungle.horse` +# +# For more: https://www.cloudsavvyit.com/1306/how-to-create-and-use-self-signed-ssl-on-nginx/ +# # To create self-signed certs on Mac, # # openssl req -x509 -sha256 -nodes -newkey rsa:2048 -days 365 -keyout localhost.key -out localhost.crt @@ -48,6 +62,21 @@ server { } } +# API backend over SSL +server { + listen 443 ssl; + listen [::]:443 ssl; + ssl_certificate /etc/ssl/certs/localhost.crt; + ssl_certificate_key /etc/ssl/private/localhost.key; + ssl_protocols TLSv1.2 TLSv1.1 TLSv1; + server_name api.jungle.horse; + location / { + proxy_set_header Host $host; + proxy_pass http://127.0.0.1:12345; + proxy_redirect off; + } +} + # TODO(2022-02-13): This is new and untested # WebSocket API backend over plain HTTP server {