Skip to content

Instantly share code, notes, and snippets.

@2get
Last active August 29, 2015 14:17
Show Gist options
  • Save 2get/96c43bedfdea6618d5a2 to your computer and use it in GitHub Desktop.
Save 2get/96c43bedfdea6618d5a2 to your computer and use it in GitHub Desktop.
Configure Nginx with non SSL and SSL as a Reverse Proxy for Local Application Server
server {
listen 80;
server_name dev.localhost;
client_max_body_size 300m;
proxy_set_header Host $http_host;
location / {
proxy_pass http://localhost:3000;
}
}
server {
listen 443;
server_name dev.localhost;
client_max_body_size 300m;
ssl on;
ssl_certificate /usr/local/etc/nginx/cert.crt;
ssl_certificate_key /usr/local/etc/nginx/cert.key;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
location / {
proxy_pass http://localhost:3000;
}
}
@2get
Copy link
Author

2get commented Mar 19, 2015

generate a certificate

sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/nginx/cert.key -out /etc/nginx/cert.crt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment