Skip to content

koddr/example-static-website-docker-nginx-certbot

Repository files navigation

Example static website with Docker, Nginx and Certbot

This is full project structure example of article How to dockerize your static website with Nginx, automatic renew SSL for domain by Certbot and deploy it to DigitalOcean?

Published on Dev.to @ 27 Jan 2020.

Requirements

  • Docker 19.x+

Usage

  • Clone this repository and go to folder:
git clone https://github.com/koddr/example-static-website-docker-nginx-certbot.git
cd example-static-website-docker-nginx-certbot
  • Change site.com to your domain at files:
./docker-compose.prod.yml
./webserver/nginx/default.conf
./webserver/nginx/site.com.conf
  • Push configured project to your own git repository.
  • Go to DigitalOcean account, create and configure new droplet (see screenshots in article).
  • Connect via SSH to your droplet and git clone your repo.
  • Check configuration of Certbot, start the process of obtaining SSL certificate in test mode:
make certbot-test DOMAINS="site.com www.site.com" [email protected]
  • If you see Congratulations!, all okay; start the process of obtaining SSL in production mode:
make certbot-prod DOMAINS="site.com www.site.com" [email protected]
  • And now, check Nginx config:
make deploy-test
  • No errors? Go your static website to production:
make deploy-prod
  • That's all!

Author

Article assistance

If you want to say «thank you»:

  1. Twit about article on your Twitter.
  2. Add a GitHub Star and make Fork to this repository.
  3. Donate some money to project author via PayPal: @paypal.me/koddr or LiberaPay.
  4. Join DigitalOcean at our referral link (your profit is $100 and we get $25).

Thanks for your support! 😘

License

MIT