The Simplest Way to Make Gitea and Nginx Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Running gitea and nginx together gives your team a fast, safe code hosting setup. The web server takes outside traffic and sends it to your internal code app. This setup lets developers push code, review changes, and run builds over encrypted web traffic. You keep the code app off the public internet while users get fast page loads. How traffic flows between gitea and nginx In a standard setup, the web server sits at the edge of your network. It listens for web requests from developer laptops

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

Running gitea and nginx together gives your team a fast, safe code hosting setup. The web server takes outside traffic and sends it to your internal code app. This setup lets developers push code, review changes, and run builds over encrypted web traffic. You keep the code app off the public internet while users get fast page loads.

How traffic flows between gitea and nginx

In a standard setup, the web server sits at the edge of your network. It listens for web requests from developer laptops and build machines. The web server handles the TLS keys so traffic stays safe in transit. Once it checks the request, it forwards the data to the code app over a local port.

The code app runs as a local service with limited system rights. It does not need root rights because it binds to a high port number. When the web server sends a request, it adds headers with the user IP address. The code app reads those headers to log who logged in and who pushed code.

User login checks still happen inside the code app or through your identity provider. You can also check client certificates at the web server level for extra safety. Both tools write to their own log files so you can track traffic and errors. Good header rules make sure the code app generates the right links for repos.

Common mistakes and how to scope network paths

Many teams leave the internal port of the code app open to the whole network. If someone finds that port, they can bypass the web server rules and TLS checks. You should bind the code app to the local loopback address or a private subnet. Firewall rules must block all traffic that does not come from the web server.

Another common mistake is using broad API tokens or shared bot accounts for build pipelines. When a shared token leaks, an attacker gets wide read and write rights to your repos. Teams should create separate service accounts with narrow roles for each build job. You also need to set body size limits on the web server for large pushes.

End-to-End Encryption + NGINX Security Configuration: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Default web server file upload limits often block developers when they push big assets. If the limit is too low, the web server drops the request before it reaches the app. You must match the upload size rules across both tools so large pushes work. You should also log all admin actions and review repo roles every month.

Keeping server maintenance and log checks safe

Setting up the web traffic is only half of the security puzzle. Engineers still need to log in to the host machine to update rules and check logs. Many teams share root SSH keys or leave management ports open to the office network. Those habits create big risks if a developer laptop gets stolen or compromised.

A better plan removes static keys and limits who can touch the production host. Admins should only get the exact rights they need for a short window of time. Every command run on the server and every database query should go into an audit log. If sensitive data like emails or phone numbers appears in outputs, masking rewrites matched fields in results.

Govern statements and responses across databases and APIs

Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev runs beside each supported service as an open-source proxy, a sidecar for your database or API.

First, hoop.dev guardrails block banned queries before they run. Then hoop.dev data masking rewrites matched sensitive values in responses in memory. The audit trail records every statement and verdict per resource. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.

Frequently asked questions

Why do large git pushes fail when using gitea and nginx?

The web server blocks large payloads by default to stop denial of service attacks. You need to raise the max body size rule on the web server to allow big pushes.

How does SSH git traffic work with this web server setup?

Standard web blocks only handle HTTP and HTTPS traffic for your code repos. For SSH pushes, you either route TCP streams through the web server or expose the SSH port directly.

Why do my Gitea audit logs show the local IP for every user?

The code app sees the IP of the web server unless you forward the real client headers. Set the web server to pass the client IP header and tell the code app to trust it.

The query runs. The emails stay hidden.