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

Posted June 27, 2019 6.1k views
GitDigitalOceanNetworkingLet's EncryptUbuntu 18.04

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?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
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
  • @Buscedv I was able to use your steps to get it working on the 1-click app also. I just did the Nginx steps and updated my gitea installation to the latest.

    I have one question though… you mention that the ssl is only for domain names. What do you mean by that?

    Also, there is some weird formatting in one section above. I was able to figure out where the underscores where, but if you can still edit the post, it might be helpful to other people.

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.


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!