Skip to content

Instantly share code, notes, and snippets.

@travist
Created March 20, 2017 16:18
Show Gist options
  • Save travist/dd5308ff4a1973db92f83ff57b97d93b to your computer and use it in GitHub Desktop.
Save travist/dd5308ff4a1973db92f83ff57b97d93b to your computer and use it in GitHub Desktop.
Form.io NGINX Configuration for Dev, Stage, and Prod
###
# A LOT OF OTHER CONFIGURATIONS MAY BE ABOVE THIS POINT.
###
server {
listen 443 ssl;
server_name dev.example.com;
ssl_certificate /usr/local/etc/nginx/nginx.crt;
ssl_certificate_key /usr/local/etc/nginx/nginx.key;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# Fix the “It appears that your reverse proxy set up is broken" error.
proxy_pass http://localhost:3000;
proxy_read_timeout 90;
proxy_redirect http://localhost:3000 https://$host;
}
}
server {
listen 443 ssl;
server_name stage.example.com;
ssl_certificate /usr/local/etc/nginx/nginx.crt;
ssl_certificate_key /usr/local/etc/nginx/nginx.key;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# Fix the “It appears that your reverse proxy set up is broken" error.
proxy_pass http://localhost:3001;
proxy_read_timeout 90;
proxy_redirect http://localhost:3001 https://$host;
}
}
server {
listen 443 ssl;
server_name prod.example.com;
ssl_certificate /usr/local/etc/nginx/nginx.crt;
ssl_certificate_key /usr/local/etc/nginx/nginx.key;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# Fix the “It appears that your reverse proxy set up is broken" error.
proxy_pass http://localhost:80;
proxy_read_timeout 90;
proxy_redirect http://localhost:80 https://$host;
}
}
###
# A LOT OF OTHER CONFIGURATIONS MAY BE BELOW THIS POINT
###
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment