How to setup ssl (HTTPS) on 1-click install Gitea droplet?

June 27, 2019 682 views
DigitalOcean Networking Git Ubuntu 18.04 Let's Encrypt

I have a 1-click install droplet with Gitea, but it only works over HTTP how can I set it up to work over HTTPS?

3 Answers

I have figured out how to set it up (but I think it only works with domain names though…)
And don’t use the 1-click droplet, instead create a standard ubuntu 18.04 droplet

Initial updates & installs
apt-get update
apt-get upgrade
apt-get autoremove
apt-get install nginx
Set up users
adduser git
sudo usermod -aG sudo git
Folder structure setup
cd ~
sudo mkdir -p /var/lib/gitea/{custom,data,indexers,public,log}
sudo chown git:git /var/lib/gitea/{data,indexers,log}
sudo chmod 750 /var/lib/gitea/{data,indexers,log}
sudo mkdir /etc/gitea
sudo chown root:git /etc/gitea
sudo chmod 770 /etc/gitea
sudo service nginx enable
sudo service nginx start
sudo service nginx status
sudo rm /etc/nginx/sites-enabled/default
Gitea installation
sudo wget -O gitea
sudo chmod +x gitea
sudo cp gitea /usr/local/bin/gitea
ssl (Only for domain names)
sudo service nginx stop
sudo apt install certbot python-certbot-nginx
sudo certbot certonly --standalone -d [domain name]
sudo service nginx start
touch /etc/nginx/sites-available/git
sudo nano /etc/nginx/sites-available/git
Paste in this code and replace [YOUR-DOMAIN-HERE] with ex. (your domain name)

*server {

listen 443 ssl;
servername [YOUR-DOMAIN-HERE];
certificate /etc/letsencrypt/live/[YOUR-DOMAIN-HERE]/fullchain.pem;
sslcertificatekey /etc/letsencrypt/live/[YOUR-DOMAIN-HERE]/privkey.pem;

location / {
    proxy_set_header  X-Real-IP  $remote_addr;
    proxy_pass http://localhost:3000;


Redirect HTTP requests to HTTPS

server {

listen 80;
servername [YOUR-DOMAIN-HERE];
return 301 https://$host$request

sudo ln -s /etc/nginx/sites-available/git /etc/nginx/sites-enabled
sudo service nginx restart
start gitea
sudo gitea web

I have the same issue and the link above does not work. I tried everything from the official Gitea Docs but it simply does not work. Can anyone please provide some more details?

  • You can read my answer (the accepted solution)

    • Hello @Buscedv you are totally right, but I do not believe that your post should be not be marked as Answered. You have shown how to install Gitea on Ubuntu and install nginx as a server and addins SSL to nginx. That is a different question. The question was how to add SSL to the 1-click install offered by DO.

      You can definitely install Gitea on Ubuntu and I have already done that (a bit different than what you mentioned but still..) but the whole purpose of 1-click install is that you do not have to always do all of the steps above. Also, the 1-click install I believe does not use nginx. Not sure as there is no information on it.

      • Yeah I know but first of all, the 1-click droplet is outdated and second of all this was my own question and I found an answer.

        • Hello @Buscedv it is a good answer and I am happy you have found it. I am still hopeful that the 1-click install gets an update and some more details on how it is setup and how to add SSL to it :)


There are a few ways to achive that, you could take a look at the Gitea official documentation on how to do this here:

Let me know if something is not clear and I’ll be happy to help!


Have another answer? Share your knowledge.