[Tutorial] Adding Lets Encrypt to Gitea
In the last post I showed you how to set up Gitea with Nginx on an Ubuntu box. Now we’ll set up a Lets Encrypt certificate on that install.
For this part we need to download some extra software from Lets Encrypt. It is very easy an takes just a couple of minutes to Finnish the whole process.
Run the following commands.
sudo apt-get update
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update
sudo apt-get install python-certbot-nginx
Now we have installed the software we need. The next step is to get the certificate for our server.
sudo certbot --nginx
Follow the on-screen instructions. On the last question, I would advise to answer option “2” – auto redirect. That will automatic redirect any requests to the http address to the https part.
To reflect the changes, you should now edit your Gitea configuration file.
sudo nano /home/git/custom/conf/app.ini
Find the line that looks like
ROOT_URL = http://example.com/
and change it to
ROOT_URL = https://example.com/
Save the file and exit your editor.
For the changes to take effect, you have to restart the Gitea service.
sudo service gitea restart
The above commands and references is assuming you followed the tutorial for setting up Gitea with Nginx. If not, change it to fit your environment.
Your Gitea install are now secure and encrypted.
To learn more about Lets Encrypt, visit their website at https://letsencrypt.org and feel free to make a donation to them for the work they are doing!