Gitea: Ports and sub-path are not working

Created on 22 Mar 2020  路  3Comments  路  Source: go-gitea/gitea

  • Gitea version (or commit ref):1.12.0+dev-32-gdcaa5643d built with GNU Make 4.2.1, go1.14.1 : bindata, sqlite, sqlite_unlock_notify

    • Git version:

    • Operating system:OpenMediaVault

    • Database (use [x]):

    • [ ] PostgreSQL

    • [ ] MySQL

    • [ ] MSSQL

    • [x] SQLite

    • Can you reproduce the bug at https://try.gitea.io:

    • [ ] Yes (provide example URL)

    • [ ] No

    • [x] Not relevant

    • Log gist:

Description

I'm sorry, please forgive me, my English is not very good

I run gitea in docker and use Nginx to reverse proxy

I only applied for an SSL certificate for my domain name: home.example.com, and I can't access home through ports 80 and 443

I want to access gitea via https://home.example.com:9881/git/

The documentation in https://docs.gitea.io/en-us/reverse-proxies/#using-nginx-with-a-sub-path-as-a-reverse-proxy doesn't work, it returns 404

The method provided in #6943 https://github.com/linuxserver/reverse-proxy-confs/blob/master/gitea.subfolder.conf.sample is able to display the homepage normally, but when I login successfully, the page jumps to https://home.example.com/git/

Here are my configuration files:

    location /git {
        return 301 $scheme://$host/git/;
    }

    location ^~ /git/ {
        resolver 172.17.0.2 valid=30s;
        set $upstream_app 172.17.0.2;
        set $upstream_port 3000;
        set $upstream_proto http;
        proxy_pass $upstream_proto://$upstream_app:$upstream_port;

        rewrite /git(.*) $1 break;
    }


[server]
APP_DATA_PATH    = /data/gitea
SSH_DOMAIN       = home.example.com:9888
HTTP_PORT        = 3000
ROOT_URL         = https://home.example.com:9881/git/
DISABLE_SSH      = false
SSH_PORT         = 9888
SSH_LISTEN_PORT  = 22
LFS_START_SERVER = true
LFS_CONTENT_PATH = /disk2/data/git/lfs
DOMAIN           = home.example.come:9881
OFFLINE_MODE     = false

In addition, I found that I can't access http://home.example.com:9889/git/ normally even without using a reverse proxy.

APP_DATA_PATH    = /data/gitea
SSH_DOMAIN       = home.example.com:9888
HTTP_PORT        = 3000
ROOT_URL         = https://home.example.com:9889/git/
DISABLE_SSH      = false
SSH_PORT         = 9888
SSH_LISTEN_PORT  = 22
LFS_START_SERVER = true
LFS_CONTENT_PATH = /disk2/data/git/lfs
DOMAIN           = home.example.come:9889
OFFLINE_MODE     = false

The sub-path has caused me a lot of trouble. I don't think this is a mature function that can be written into the Features

Screenshots

TIM鎴浘20200322235709.png
TIM鎴浘20200323001155.png

kinquestion

Most helpful comment

I added the port in the Nginx configuration, and now I can login normally
But I still hope that gitea can be configured as simple as the documentation to achieve the same effect

location /git {
        return 301 $scheme://$host:$server_port/git/;
    }

    location ^~ /git/ {
        resolver 172.17.0.2 valid=30s;
        set $upstream_app 172.17.0.2;
        set $upstream_port 3000;
        set $upstream_proto http;
        proxy_pass $upstream_proto://$upstream_app:$upstream_port;

        rewrite /git(.*) $1 break;
    }

All 3 comments

I added the port in the Nginx configuration, and now I can login normally
But I still hope that gitea can be configured as simple as the documentation to achieve the same effect

location /git {
        return 301 $scheme://$host:$server_port/git/;
    }

    location ^~ /git/ {
        resolver 172.17.0.2 valid=30s;
        set $upstream_app 172.17.0.2;
        set $upstream_port 3000;
        set $upstream_proto http;
        proxy_pass $upstream_proto://$upstream_app:$upstream_port;

        rewrite /git(.*) $1 break;
    }

Please feel free to submit PR to improve documentation

Closing as resolved configuration issue

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jonasfranz picture jonasfranz  路  3Comments

mirhec picture mirhec  路  3Comments

tuxfanou picture tuxfanou  路  3Comments

jakimfett picture jakimfett  路  3Comments

adpande picture adpande  路  3Comments