mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-30 04:17:37 +01:00
Add HAProxy Config to reverse-proxies.en-us.md (#17407)
* Update reverse-proxies.en-us.md Addition of HAProxy * Update reverse-proxies.en-us.md
This commit is contained in:
parent
07c7100c60
commit
932780c2bb
1 changed files with 47 additions and 0 deletions
|
@ -292,3 +292,50 @@ If you wish to run Gitea with IIS. You will need to setup IIS with URL Rewrite a
|
|||
</system.webServer>
|
||||
</configuration>
|
||||
```
|
||||
|
||||
## HAProxy
|
||||
|
||||
If you want HAProxy to serve your Gitea instance, you can add the following to your HAProxy configuration
|
||||
|
||||
add an acl in the frontend section to redirect calls to gitea.example.com to the correct backend
|
||||
```
|
||||
frontend http-in
|
||||
...
|
||||
acl acl_gitea hdr(host) -i gitea.example.com
|
||||
use_backend gitea if acl_gitea
|
||||
...
|
||||
```
|
||||
|
||||
add the previously defined backend section
|
||||
```
|
||||
backend gitea
|
||||
server localhost:3000 check
|
||||
```
|
||||
|
||||
If you redirect the http content to https, the configuration work the same way, just remember that the connexion between HAProxy and Gitea will be done via http so you do not have to enable https in Gitea's configuration.
|
||||
|
||||
## HAProxy with a sub-path
|
||||
|
||||
In case you already have a site, and you want Gitea to share the domain name, you can setup HAProxy to serve Gitea under a sub-path by adding the following to you HAProxy configuration:
|
||||
|
||||
```
|
||||
frontend http-in
|
||||
...
|
||||
acl acl_gitea path_beg /gitea
|
||||
use_backend gitea if acl_gitea
|
||||
...
|
||||
```
|
||||
|
||||
With that configuration http://example.com/gitea/ will redirect to your Gitea instance.
|
||||
|
||||
then for the backend section
|
||||
```
|
||||
backend gitea
|
||||
http-request replace-path /gitea\/?(.*) \/\1
|
||||
server localhost:3000 check
|
||||
```
|
||||
|
||||
The added http-request will automatically add a trailing slash if needed and internally remove /gitea from the path to allow it to work correctly with Gitea by setting properly http://example.com/gitea as the root.
|
||||
|
||||
Then you **MUST** set something like `[server] ROOT_URL = http://example.com/gitea/` correctly in your configuration.
|
||||
|
||||
|
|
Loading…
Reference in a new issue