Question

How do I setup Gitea with a domain name or sub-domain?

Hey I’ve tried Apache and Nginx and can’t get either working with the image from the DigitalOcean Marketplace. So Here’s what I have:

  • Small VPS with Gitea on Ubuntu 18.04
  • Domain Name and Sub Domain’s DNS pointed to the VPS’s IP

I’ve tried:

  • Disabling UFW
  • Apache + Nginx (not at the same time)
  • I’m getting stuck setting up my domain name in either of those then keep deleting the droplet ^_^
Show comments

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 finally figured it out in Apache!!! For anyone trying to get gitea running on Apache with a domain or subdomain, install apache:

sudo apt-get install apache2 -y

Next fix apache. There’s a localhost error that’s built into apache that drives me nuts… to fix it run:

echo "ServerName localhost" >> /etc/apache2/apache2.conf

Next fix apache for gitea. If you’re using a Gitea droplet apache will have thrown an error during install. This is ok, it’s just cuz its trying to initialize with a default setup on port 80 and Gitea is config’d to that port on DigitialOcean’s image. So to disable 000-default

sudo a2dissite 000-default.conf

Then there are 2 apache mods required, so to install those type:

sudo a2enmod proxy
sudo a2enmod proxy_http

Next create, enable, and edit a new conf file for apache:

sudo touch /etc/apache2/sites-available/gitea.conf
sudo a2ensite gitea
sudo nano /etc/apache2/sites-available/gitea.conf

Then add setup the reverse proxy

<VirtualHost *:80>
    ServerName git.example.com
    ProxyPreserveHost On
    ProxyRequests off
    ProxyPass / http://localhost:3000/
    ProxyPassReverse / http://localhost:3000/
</VirtualHost>

Finally restart apache (if you get an error about it already being stopped it’s cuz it never started because of the droplet error)

sudo service apache2 stop
sudo service apache2 start
systemctl status apache2.service

Try DigitalOcean for free

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

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

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

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel