You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/content/administration/reverse-proxies.en-us.md
+15-6
Original file line number
Diff line number
Diff line change
@@ -61,22 +61,31 @@ server {
61
61
62
62
## Nginx with a sub-path
63
63
64
-
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`:
64
+
In case you already have a site, and you want Gitea to share the domain name,
65
+
you can setup Nginx to serve Gitea under a sub-path by adding the following `server` section
66
+
into the `http` section of `nginx.conf`:
65
67
66
68
```nginx
67
69
server {
68
70
...
69
-
# Note: Trailing slash
70
-
location /gitea/ {
71
+
location /gitea {
72
+
return 301 $scheme://$host/gitea/;
73
+
}
74
+
location ~ ^/(gitea|v2)/ {
71
75
client_max_body_size 512M;
72
76
73
-
# make nginx use unescaped URI, keep "%2F" as is
77
+
# make nginx use unescaped URI, keep "%2F" as-is, remove the "/gitea" sub-path prefix, pass "/v2" as-is.
74
78
rewrite ^ $request_uri;
75
-
rewrite ^/gitea(/.*) $1 break;
79
+
rewrite ^(/gitea)?(/.*) $2 break;
76
80
proxy_pass http://127.0.0.1:3000$uri;
77
81
78
82
# other common HTTP headers, see the "Nginx" config section above
0 commit comments