From b7108b0b20d0ba5f14402dad845778e30b739041 Mon Sep 17 00:00:00 2001 From: Cassie Tarakajian Date: Thu, 17 May 2018 17:25:45 -0700 Subject: [PATCH] add nginx configuration to repo --- nginx.conf | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 nginx.conf diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 00000000..ec704743 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,61 @@ + # HTTP - redirect all requests to HTTPS: + server { + listen 80; + server_name alpha.editor.p5js.org; + location / { + proxy_pass http://127.0.0.1:8000; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection 'upgrade'; + proxy_set_header Host $host; + proxy_cache_bypass $http_upgrade; + } + location ~* \/login(\/)* { + return 301 https://$host$request_uri; + } + location ~* \/signup(\/)* { + return 301 https://$host$request_uri; + } + location ~* \/reset-password(\/)* { + return 301 https://$host$request_uri; + } + location ~* "\/[a-zA-Z0-9._-]{1,20}\/account(\/)*" { + return 301 https://$host$request_uri; + } + +} + +server { + listen 443; + ssl on; + ssl_certificate /etc/letsencrypt/live/alpha.editor.p5js.org/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/alpha.editor.p5js.org/privkey.pem; + server_name alpha.editor.p5js.org; + location / { + proxy_pass http://127.0.0.1:8000; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection 'upgrade'; + proxy_set_header Host $host; + proxy_cache_bypass $http_upgrade; + } +} + +server { + listen 80; + server_name editor.p5js.org; + location ~ ^/(.*) { + return 302 http://alpha.editor.p5js.org/$1; + } +} + +server { + listen 443; + ssl on; + ssl_certificate /etc/letsencrypt/live/editor.p5js.org/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/editor.p5js.org/privkey.pem; + server_name editor.p5js.org; + location ~ ^/(.*) { + return 302 https://alpha.editor.p5js.org/$1; + } +} \ No newline at end of file