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/doc/usage/reverse-proxies.en-us.md
+68
Original file line number
Diff line number
Diff line change
@@ -44,6 +44,74 @@ server {
44
44
45
45
Then set `[server] ROOT_URL = http://git.example.com/git/` in your configuration.
46
46
47
+
## Using Nginx as a reverse proxy and serve static resources directly
48
+
We can tune the performance in splitting requests into categories static and dynamic.
49
+
50
+
CSS files, JavaScript files, images and web fonts are static content.
51
+
The front page, a repository view or issue list is dynamic content.
52
+
53
+
Nginx can serve static resources directly and proxy only the dynamic requests to gitea.
54
+
Nginx is optimized for serving static content, while the proxying of large responses might be the opposite of that
55
+
(see https://serverfault.com/q/587386).
56
+
57
+
Download a snap shot of the gitea source repository to `/path/to/gitea/`.
58
+
59
+
We are only interested in the `public/` directory and you can delete the rest.
60
+
61
+
Depending on the scale of your user base, you might want to split the traffic to two distinct servers,
62
+
or use a cdn for the static files.
63
+
64
+
### using a single node and a single domain
65
+
66
+
Set `[server] STATIC_URL_PREFIX = /_/static` in your configuration.
67
+
68
+
```
69
+
server {
70
+
listen 80;
71
+
server_name git.example.com;
72
+
73
+
location /_/static {
74
+
alias /path/to/gitea/public;
75
+
}
76
+
77
+
location / {
78
+
proxy_pass http://localhost:3000;
79
+
}
80
+
}
81
+
```
82
+
83
+
### using two nodes and two domains
84
+
85
+
Set `[server] STATIC_URL_PREFIX = http://cdn.example.com/gitea` in your configuration.
86
+
87
+
```
88
+
# application server running gitea
89
+
server {
90
+
listen 80;
91
+
server_name git.example.com;
92
+
93
+
location / {
94
+
proxy_pass http://localhost:3000;
95
+
}
96
+
}
97
+
```
98
+
99
+
```
100
+
# static content delivery server
101
+
server {
102
+
listen 80;
103
+
server_name cdn.example.com;
104
+
105
+
location /gitea {
106
+
alias /path/to/gitea/public;
107
+
}
108
+
109
+
location / {
110
+
return 404;
111
+
}
112
+
}
113
+
```
114
+
47
115
## Using Apache HTTPD as a reverse proxy
48
116
49
117
If you want Apache HTTPD to serve your Gitea instance, you can add the following to your Apache HTTPD configuration (usually located at `/etc/apache2/httpd.conf` in Ubuntu):
0 commit comments