Question

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

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?


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

Accepted Answer

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

Nginx

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 https://dl.gitea.io/gitea/1.8.3/gitea-1.8.3-linux-amd64
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. example.com (your domain name)

*server {
listen 443 ssl; server_name [YOUR-DOMAIN-HERE]; ssl_certificate /etc/letsencrypt/live/[YOUR-DOMAIN-HERE]/fullchain.pem; ssl_certificate_key /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; server_name [YOUR-DOMAIN-HERE]; return 301 https://$host$request_uri; } *

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?

Bobby Iliev
Site Moderator
Site Moderator badge
June 28, 2019

Hello,

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

https://docs.gitea.io/en-us/https-setup/

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

Regards, Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.