- Install nginx
sudo apt install nginx
- Install certbot
sudo apt install certbot
- Obtain certs
sudo certbot certonly --standalone --preferred-challenges http -d example.com
- Copy example.com.conf
cp exmaple.com.conf sites/my-domain.com.conf
DO NOT FORGET TO CHANGE CONTENT OF example.com.conf
- Change the
/etc/nginx/nginx.conf
echo "include $(pwd)/nginx.conf" > /etc/nginx/nginx.conf
- In the current nginx.conf replace the
include
to you directory
sed -i "s|#Sites|include $(pwd)/nginx/sites/\*\.conf;|g" nginx.conf
- Test configuration
nginx -t
- Reload nginx
nginx -s reload