limit req
This commit is contained in:
@@ -4,34 +4,94 @@ upstream gitea {
|
||||
keepalive 16;
|
||||
}
|
||||
|
||||
server {
|
||||
# limit req
|
||||
limit_req_zone $binary_remote_addr zone=gitea_limit:10m rate=10r/s;
|
||||
|
||||
server {
|
||||
listen 443 quic;
|
||||
listen 443 ssl;
|
||||
http2 on;
|
||||
http3 on;
|
||||
ssl_protocols TLSv1.3;
|
||||
ssl_protocols TLSv1.3;
|
||||
ssl_early_data on;
|
||||
add_header Alt-Svc 'h3=":$server_port"; ma=10000';
|
||||
server_name gitea.linuxiarz.pl;
|
||||
include config/wildcard.conf;
|
||||
|
||||
# logging
|
||||
server_name gitea.linuxiarz.pl;
|
||||
include config/wildcard.conf;
|
||||
|
||||
# Logging
|
||||
access_log /var/log/angie/gitea.linuxiarz.pl.access.log;
|
||||
error_log /var/log/angie/gitea.linuxiarz.pl.error.log warn;
|
||||
error_log /var/log/angie/gitea.linuxiarz.pl.error.log warn;
|
||||
|
||||
status_zone gitea.linuxiarz.pl;
|
||||
|
||||
limit_req zone=gitea_limit burst=20 nodelay;
|
||||
|
||||
location ~* ^.+\.(css|js|jpg|jpeg|gif|png|ico|svg|woff|woff2|ttf|eot)$ {
|
||||
proxy_pass http://gitea;
|
||||
include config/proxy.conf;
|
||||
|
||||
proxy_cache public-cache;
|
||||
proxy_cache_valid 200 304 30d;
|
||||
proxy_cache_valid 301 302 1h;
|
||||
proxy_cache_valid any 1m;
|
||||
proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
|
||||
proxy_cache_background_update on;
|
||||
proxy_cache_lock on;
|
||||
proxy_cache_revalidate on;
|
||||
|
||||
add_header Cache-Control "public, max-age=2592000, immutable";
|
||||
add_header X-Cache-Status $upstream_cache_status;
|
||||
expires 30d;
|
||||
}
|
||||
|
||||
location ~ ^/(api|.*\.git) {
|
||||
limit_req zone=gitea_limit burst=5 nodelay;
|
||||
|
||||
proxy_pass http://gitea;
|
||||
include config/proxy.conf;
|
||||
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_read_timeout 600s;
|
||||
}
|
||||
|
||||
location ~ ^/(avatars|attachments|repo-avatars) {
|
||||
proxy_pass http://gitea;
|
||||
include config/proxy.conf;
|
||||
|
||||
proxy_cache public-cache;
|
||||
proxy_cache_valid 200 7d;
|
||||
proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
|
||||
|
||||
add_header Cache-Control "public, max-age=604800";
|
||||
add_header X-Cache-Status $upstream_cache_status;
|
||||
}
|
||||
|
||||
location / {
|
||||
proxy_pass http://gitea;
|
||||
include config/proxy.conf;
|
||||
}
|
||||
|
||||
proxy_cache public-cache;
|
||||
proxy_cache_valid 200 5m;
|
||||
proxy_cache_bypass $cookie_i_like_gitea $arg_nocache;
|
||||
proxy_no_cache $cookie_i_like_gitea;
|
||||
proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $http_connection;
|
||||
|
||||
add_header X-Cache-Status $upstream_cache_status;
|
||||
}
|
||||
}
|
||||
|
||||
# HTTP redirect
|
||||
server {
|
||||
listen 80;
|
||||
listen 80;
|
||||
server_name gitea.linuxiarz.pl;
|
||||
|
||||
location / {
|
||||
|
||||
Reference in New Issue
Block a user