Nginx and Certbot to build a server to support multiple web sites

Install and config nginx first.

I followed these two instructions:

Remember to config “sites-available” seperately, try not to config the global config file, for two reasons:

  1. It’ll be easier to maintain.
  2. Certbot is not that clever, so we want to leave the global config file to Certbot.

Read Certbot manual first then follow quick instructions from Certbot homepage

Follow the official instructions to install Certbot correctly.

Then we need to choose a command to call a plugin to get CA.
After I finished reading, I found out many unofficial instructions online are outdated.

If we install Certbot correctly, we only need to use command:

1
certbot --nginx

Then Certbot can do all for you. Even can create a cron job to renew certificate automatically.