Skip to content

Instantly share code, notes, and snippets.

@MattSegal
Created December 31, 2020 08:49
Show Gist options
  • Save MattSegal/1696ceb2b54200c51e701ed9d2100ae3 to your computer and use it in GitHub Desktop.
Save MattSegal/1696ceb2b54200c51e701ed9d2100ae3 to your computer and use it in GitHub Desktop.
### Virtual Host Config
## HTTP Redirects
server {
listen 80;
listen [::]:80;
server_name www.mattslinks.xyz;
return 301 http://mattslinks.xyz$request_uri;
}
server {
listen 80;
listen [::]:80;
server_name www.blogreader.com.au;
return 301 http://blogreader.com.au$request_uri;
}
server {
listen 80;
listen [::]:80;
server_name www.memories.ninja;
return 301 http://memories.ninja$request_uri;
}
## Reverse proxy all HTTP requests to gunicorn
server {
listen 80;
listen [::]:80;
server_name memories.ninja;
location / {
proxy_pass http://127.0.0.1:8000;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_redirect http://127.0.0.1:8000 https://memories.ninja;
}
}
server {
listen 80;
listen [::]:80;
server_name mattslinks.xyz;
location / {
proxy_pass http://127.0.0.1:8001;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_redirect http://127.0.0.1:8001 https://mattslinks.xyz;
}
}
server {
listen 80;
listen [::]:80;
server_name blogreader.com.au;
location / {
proxy_pass http://127.0.0.1:8005;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_redirect http://127.0.0.1:8005 https://blogreader.com.au;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment