From 416ded5f3eed16cf4efb202f2c66db4460dce2c3 Mon Sep 17 00:00:00 2001 From: Fluf <36822577+flufmonster@users.noreply.github.com> Date: Wed, 23 May 2018 01:21:17 -0400 Subject: [PATCH] Add documentation for reverse proxies (#4022) Fixes #3904 --- .../doc/usage/reverse-proxies.en-us.md | 102 ++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 docs/content/doc/usage/reverse-proxies.en-us.md diff --git a/docs/content/doc/usage/reverse-proxies.en-us.md b/docs/content/doc/usage/reverse-proxies.en-us.md new file mode 100644 index 000000000..2fde3ec31 --- /dev/null +++ b/docs/content/doc/usage/reverse-proxies.en-us.md @@ -0,0 +1,102 @@ +--- +date: "2018-05-22T11:00:00+00:00" +title: "Usage: Reverse Proxies" +slug: "reverse-proxies" +weight: 17 +toc: true +draft: false +menu: + sidebar: + parent: "usage" + name: "Reverse Proxies" + weight: 16 + identifier: "reverse-proxies" +--- + +## Using Nginx as a reverse proxy +If you want Nginx to serve your Gitea instance you can the following `server` section inside the `http` section of `nginx.conf`: + +``` +server { + listen 80; + server_name git.example.com; + + location / { + proxy_pass http://localhost:3000; + } +} +``` + +## Using Nginx with a Sub-path as a reverse proxy + +In case you already have a site, and you want Gitea to share the domain name, you can setup Nginx to serve Gitea under a sub-path by adding the following `server` section inside the `http` section of `nginx.conf`: + +``` +server { + listen 80; + server_name git.example.com; + + location /git/ { # Note: Trailing slash + proxy_pass http://localhost:3000/; # Note: Trailing slash + } +} +``` + +Then set `[server] ROOT_URL = http://git.example.com/git/` in your configuration. + +## Using Apache HTTPD as a reverse proxy + +If you want Apache HTTPD to serve your Gitea instance you can add the following to you Apache HTTPD configuration (usually located at `/etc/apache2/httpd.conf` in Ubuntu): + +``` + + ... + ProxyPreserveHost On + ProxyRequests off + ProxyPass / http://localhost:3000/ + ProxyPassReverse / http://localhost:3000/ + +``` + +Note: The following Apache HTTPD mods must be enabled: `proxy`, `proxy_http` + +## Using Apache HTTPD with a Sub-path as a reverse proxy + +In case you already have a site, and you want Gitea to share the domain name, you can setup Apache HTTPD to serve Gitea under a sub-path by adding the following to you Apache HTTPD configuration (usually located at `/etc/apache2/httpd.conf` in Ubuntu): + +``` + + ... + + Order allow,deny + Allow from all + + + ProxyPass /git http://localhost:3000 # Note: no trailing slash after either /git or port + ProxyPassReverse /git http://localhost:3000 # Note: no trailing slash after either /git or port + +``` + +Then set `[server] ROOT_URL = http://git.example.com/git/` in your configuration. + +Note: The following Apache HTTPD mods must be enabled: `proxy`, `proxy_http` + +## Using Caddy with a Sub-path as a reverse proxy + +If you want Caddy to serve your Gitea instance you can add the following server block to your Caddyfile: + +``` +git.example.com { + proxy / http://localhost:3000 +} +``` + +##### How do I set up a sub-path with Caddy? + +In case you already have a site, and you want Gitea to share the domain name, you can setup Caddy to serve Gitea under a sub-path by adding the following to you server block in your Caddyfile: + +``` +git.example.com { + proxy /git/ http://localhost:3000 # Note: Trailing Slash after /git/ +} +```