add nginx configuration to repo

This commit is contained in:
Cassie Tarakajian 2018-05-17 17:25:45 -07:00
parent 56ab483732
commit b7108b0b20

61
nginx.conf Normal file
View file

@ -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;
}
}