A full-stack https application boilerplate made with Docker, LetsEncrypt, Nginx, React, and Express
- Docker
- Docker Compose
- Domain name with DNS records pointing at target machine
- Clone project
git clone https://github.com/munikeraragon/react-express-letsencrypt-nginx-boilerplate.git
- cd into folder
cd react-express-letsencrypt-nginx-boilerplate
-
Edit init-letsecncrypt.sh by replacing "example.com" and "www.example.com" with your domain name
-
Edit ./data/nginx/app.conf by replacing "example.com" with your domain name
-
Edit ./server/index.js by replacing "example.com" with your domain name
-
Generate Letsencrypt certificates
sudo ./init-letsencrypt.sh
- Create "nodecert" group to allow Express server to read letsencrypt certifictes
# Create group "nodecert" with gid=1024
sudo groupadd nodecert -g 1024
# Add root to the group "nodecert"
sudo usermod -a -G nodecert root
# make group "nodecert" owner of files recursively
sudo chgrp -R nodecert data/certbot/conf/live
sudo chgrp -R nodecert data/certbot/conf/archive
# change permission of files to be accesible by group "nodecert"
sudo chmod -R 750 data/certbot/conf/live
sudo chmod -R 750 data/certbot/conf/archive
- Build docker-compose services
docker-compose build
- Run docker-compose services
docker-compose up
- Access React client at https://your_domain_name.com and Express server at https://your_domain_name.com:5000
Article: https://www.codegrow.org