Yet another way to work with Apache2 proxy



  • your valid domain: mydomain
  • your Gogs port: 8103
  • your desired public URL for Gogs: http://mydomain/gogs

Step 1: Edit <Your Gogs Root>/custom/conf/app.ini

DOMAIN = mydomain
HTTP_PORT = 8103
ROOT_URL = http://mydomain/gogs

Step 2: Edit /etc/apache2/mods-enabled/proxy.conf

# Gogs
ProxyPass           /gogs       http://localhost:8103
ProxyPassReverse    /gogs       http://localhost:8103
<Location /gogs>
    Require all granted

Step 3: Restart apache2 and Gogs, and have a try with your browser!

Running app on subdir. HTTP 404 error

Worth mentioning this can also be done in virtual hosts config too


on step2 you need
ProxyPass /gogs http://localhost:8103/
ProxyPassReverse /gogs http://localhost:8103/


With the trailing / as per your version, I get 404 on the login page. Only the home page will show.


I find that the <Location> block is unnecessary.


You should add

HTTP_ADDR = localhost

to prevent people bypassing Apache.