p5.js-web-editor/nginx/nginx.conf
2018-05-30 15:29:59 -07:00

61 lines
No EOL
1.7 KiB
Nginx Configuration File

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