Skip to content

Instantly share code, notes, and snippets.

@dmathewwws
Last active April 18, 2016 23:17
Show Gist options
  • Save dmathewwws/6043fb880dc31e0cde23c60d5d8ea995 to your computer and use it in GitHub Desktop.
Save dmathewwws/6043fb880dc31e0cde23c60d5d8ea995 to your computer and use it in GitHub Desktop.
# HTTP - redirect all requests to HTTPS
server {
listen 80;
listen [::]:80 default_server ipv6only=on;
return 301 https://$host$request_uri;
}
# HTTPS - proxy requests to /parse-server/
# through to Parse Server
server {
listen 443 ssl;
server_name your-domain.com www.your-domain.com;
root /usr/share/nginx/html;
index index.html index.htm;
ssl on;
# Use certificate and key provided by Let's Encrypt:
ssl_certificate /etc/nginx/ssl/chained.pem;
ssl_certificate_key /etc/nginx/ssl/domain.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';
# Pass requests for /parse/ to Parse Server instance at localhost:1337
location /parse-server/ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://localhost:1337/;
proxy_ssl_session_reuse off;
proxy_set_header Host $http_host;
proxy_redirect off;
}
location /dashboard/ {
proxy_pass http://localhost:4040/dashboard/;
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 https;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment