Skip to content

Managing virtual hosts with letsencrypt and nginx

Notifications You must be signed in to change notification settings

alpha14/nginx-le-setup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

72 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nginx Letsencrypt setup

This script helps creating pre-configured virtual hosts using let's encrypt.
It forces https redirection by default.

Installation

First we need some dependencies (only tested on debian based distros)

apt install nginx
pip3 install certbot

Get in from git

git clone https://github.com/alpha14/nginx-le-setup
cd nginx-le-setup

Usage

Example for setting up a static website

sudo ./nginx-le-setup.sh add --name example.com --directory /opt/website --email [email protected]

Example for setting up a service in reverse proxy

sudo ./nginx-le-setup.sh add --name example.com --proxy 8080 --email [email protected]

Configuration file

A config file can be placed in ~/.nginx-le-setup to avoid specifying some parameters

EMAIL="[email protected]"

WEBROOT_PATH="/data/letsencrypt"

# Additional HSTS directive
HSTS="includeSubDomains; preload"