Skip to content

Instantly share code, notes, and snippets.

Avatar

Anand Kashyap anand-kashyap

View GitHub Profile
@anand-kashyap
anand-kashyap / nginx-docker.txt
Last active Feb 10, 2021
nginx as docker container
View nginx-docker.txt
// use docker compose for running server and passing env files
// create a network before running nginx container
docker network create --driver bridge reverse-proxy
// then run nginx container
docker run -d -p 80:80 -p 443:443 \
--name nginx-proxy \
--net reverse-proxy \
-v $HOME/certs:/etc/nginx/certs:ro \
@anand-kashyap
anand-kashyap / nginxSubGen.sh
Created Dec 27, 2020
Create a nodejs subdomain config for nginx and optionally register ssl via letsencrypt
View nginxSubGen.sh
#!/bin/bash
#
# make script executable first with chmod +x scriptname
# Bash script for generating new subdomain with a new server block(nodejs by default) in Nginx.
# syntax - ./{scriptname} subDomainName mainDomainName PORT
# note - needs certbot enabled for letsencrypt
# Functions
ok() { echo -e '\e[32m'$1'\e[m'; } # Green