This commit is contained in:
2026-04-07 15:58:45 -07:00
parent 376f5530d7
commit e45e2c28a9
7 changed files with 197 additions and 0 deletions

49
nginx.conf Normal file
View File

@@ -0,0 +1,49 @@
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Gitea subfolder - completely transparent to Gitea
server {
listen 80;
server_name localhost;
client_max_body_size 20M;
location /gitea/ {
# Strip /gitea prefix when forwarding to Gitea
rewrite ^/gitea/(.*) /$1 break;
proxy_pass http://gitea:3000/;
proxy_set_header Host $host;
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_set_header X-Forwarded-Prefix /gitea;
# Rewrite Location headers (redirects)
proxy_redirect ~^(http|https)://([^/]+):3000(/.*)$ $1://$host/gitea$3;
# Rewrite URLs in response body (HTML, JSON, etc.)
sub_filter_once off;
sub_filter_types text/html application/json;
sub_filter 'http://gitea:3000' 'http://$host/gitea';
sub_filter 'http://raspberrypi:3000' 'http://$host/gitea';
sub_filter 'https://gitea:3000' 'http://$host/gitea';
sub_filter 'https://raspberrypi:3000' 'http://$host/gitea';
# WebSocket support
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
# Timeouts
proxy_connect_timeout 60s;
proxy_send_timeout 60s;
proxy_read_timeout 60s;
}
}
}