This commit is contained in:
2026-04-10 08:44:51 -07:00
parent eb69ee13e6
commit cace32b273
4 changed files with 17 additions and 53 deletions

View File

@@ -6,41 +6,23 @@ http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Gitea subfolder - completely transparent to Gitea
server {
listen 80;
server_name localhost;
server_name _;
client_max_body_size 20M;
location /gitea/ {
# Strip /gitea prefix when forwarding to Gitea
rewrite ^/gitea/(.*) /$1 break;
proxy_pass http://gitea:3000/;
location / {
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;