nginx sub-path documentation #8635
Labels
issue/confirmed
Issue has been reviewed and confirmed to be present or accepted to be implemented
type/docs
This PR mainly updates/creates documentation
The setup experience can be greatly improved if the docs include the common configuration of a reverse proxy that handles SSL and uses a sub-path. Currently the docs are setup to make this difficult. Two changes to fix this are:
Default app.ini currently
Using the PROTOCOL variable conflates the listening port (http) with the external url (https). The naieve edit is to make PROTOCOL = https. This results in immediate failure becuase gitea is now listening as tls and looks for a tls key file.
It would be more more clear if the example app.ini were something like
ROOT_URL = https://example.com/
to avoid the temptation of editing PROTOCOL (this could be named better to reflect that its the listening protocol but thats another issue)Note: the app.ini from the web install process does not use the %(PROTOCOL)s form of the ROOT_URL but the gitea first-run does create an app.ini with such a ROOT_URL.
Adding a path to ROOT_URL such as '/git' would be the next edit for an admin installing gitea in a sub-path.
At this point gitea is rewriting URLs with https://example.com/git and listening on a port without tls. So far so good. The reverse proxy docs at https://docs.gitea.io/en-us/reverse-proxies/ say for a subpath to use
proxy_pass http://localhost:3000/; # Note: Trailing slash
note this does not work. example.com/git/user/word will be passed as /word and not /user/word. Only the final path part gets passed to proxy_pass. Whats needed is to remove only the added/git
part.Note: another approach which would move the complexity from nginx into gitea is to removing the trailing slash
proxy_pass http://127.0.0.1:3000
so that gitea gets all of/git/user/word
and then gitea can use the ROOT_URL to determine that /git/ is extraneous.The text was updated successfully, but these errors were encountered: