Skip to content

Instantly share code, notes, and snippets.

@ultim8k
Last active April 25, 2018 16:47
Show Gist options
  • Save ultim8k/1a4d7cb14fe096f02055133e3df67fb8 to your computer and use it in GitHub Desktop.
Save ultim8k/1a4d7cb14fe096f02055133e3df67fb8 to your computer and use it in GitHub Desktop.
SSL Me

node.js + nginx + ssl configuration for local development

TBC

#!/usr/bin/env bash
COUNTRY="UK" # COUNTRY
STATE="London" # STATE
LOCALITY="London" # LOCALITY
ORG="FOOBAR" # ORG
COMMON_NAME="foo.bar.com" # COMMON_NAME
EMAIL_ADDRESS="[email protected]"
SUBJ="/C=${COUNTRY}/ST=${STATE}/L=${LOCALITY}/O=${ORG}/CN=${COMMON_NAME}/emailAddress=${EMAIL_ADDRESS}"
openssl req \
-new \
-newkey rsa:4096 \
-days 365 \
-nodes \
-x509 \
-subj ${SUBJ} \
-keyout ssl.key \
-out ssl.cert
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
# begin of site
upstream reactSSRSocket {
server 127.0.0.1:3000;
server unix:/tmp/nodesock;
}
server {
listen 80;
server_name foo.bar.com;
rewrite ^(.*) https://foo.bar.com$1 permanent;
}
server {
listen 443 ssl http2;
ssl_certificate /YOUR_PATH_TO_SSL/ssl/certs/myssl.crt;
ssl_certificate_key /YOUR_PATH_TO_SSL/ssl/private/myssl.key;
keepalive_timeout 70;
server_name foo.bar.com;
location / {
proxy_pass http://reactSSRSocket;
}
}
# end of site
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment