Skip to content

Instantly share code, notes, and snippets.

@chrisallenlane
chrisallenlane / nginx.conf
Last active March 14, 2020 16:57
This is an nginx configuration that does the following: - Implements a RESTful API using CORS between `example.com` and `api.example.com` - Uses SSL - Reverse-proxies SSL traffic from port 443 to a NodeJS application running on port 8000 Adapted from this page, with thanks to the original author: http://enable-cors.org/server_nginx.html
# Configure the reverse-proxy on port 443
server {
# general configs
keepalive_timeout 30;
listen 127.0.0.1:443 ssl;
server_name api.example.com;
# ssl configs
ssl_certificate /path/to/api.crt;
ssl_certificate_key /path/to/api.key;