You decide which services we may enable for analytics, personalization, and external content.
We use cookies and similar technologies on our website to personalize content, embed external media, and better understand how individual areas are used.
Necessary cookies
These entries support essential functions such as security, stability, and form processing.
Optional sections
AnalyticsMarketingPersonalizationExternal media
Your data may be processed with your consent or on the basis of legitimate interests. In the cookie settings, you can reject or explicitly allow each optional category.
Some services process personal data in third countries. By consenting, you also agree to this transfer. You can find more information in our Privacy Policy.
You can reopen and change your selection at any time. · 1.0.2
Learn how to set up a secure and efficient reverse proxy for websites and game servers to improve access and protection → Find out more
10 November 20265 min read0 Views0 helpful
Introduction
A reverse proxy server acts as an intermediary between end users and another server. Websites and game servers are popular use cases for a reverse proxy, each offering benefits such as improved security, easier access, and protection.
In this guide, we’ll show you how to set up a general-purpose reverse proxy for websites, as well as one specifically for game servers.
FAQ
Frequently asked questions
It’s used for websites and game servers, offering benefits such as improved security, easier access, and protection.
Higher network speeds are recommended, especially for servers with many players, since the VPS streams raw TCP/UDP directly between the client and game server. Basic specs are usually sufficient for a web proxy.
Create an A DNS record for each subdomain you want to use, pointing to your Linux VPS IP address.
Nginx, which you can install with 'sudo apt install nginx'. You’ll then need to adjust your firewall so the service is accessible from the internet.
Feedback
Was this article helpful?
Your feedback helps us prioritize and improve content.
0 of 0 Users found this article helpful.
Personal support
Need more help than the guide provides?
Our ZAP support team knows your product — briefly describe your issue and we'll help you personally.
Navigation
VPS
Requirements
To set up a reverse proxy, you need a Linux server to host your proxy. In this example, we’re using Ubuntu as the Linux distribution, but the installation steps are very similar for most Linux distributions.
Tip
Recommended VPS specs
For a reverse proxy designed for game servers, we strongly recommend choosing higher network speeds—especially if your server has many players. Your VPS streams raw TCP/UDP directly between the client (player) and the game server. For a web proxy, basic specs with minimal upgrades are usually sufficient. :)
We recommend setting up the proxy with a domain that you own. For each subdomain you want to use, create an A DNS record (e.g. zapdocs.example.com) pointing to your Linux VPS IP address. Users will use this address to access your website or game server.
Connecting to the VPS
Once your Linux VPS is ready, you’ll need to connect to it. See our SSH Quick Start guide to learn how.
Installing Nginx
You’ll use Nginx to host the reverse proxy because it’s a high-performance and popular open-source web server.
After connecting to your VPS, install Nginx with this command:
Code
sudo apt install nginx
After installation, you’ll need to adjust your firewall so the service is accessible from the internet. For this guide, we’ll use the UFW firewall, since Nginx registers as an app and makes the setup straightforward. For more information about the UFW firewall, see our Linux Security Tips guide.
Info
If you’re using another firewall (e.g. Iptables), make sure to allow Nginx access to ports 80 and 443, which the service uses.
You can view the Nginx profiles with sudo ufw app list. Here, we’ll choose Nginx Full, which allows HTTP for testing and HTTPS for production.
Code
sudo ufw allow 'Nginx Full'
You can now test whether the site is reachable in your browser. If the test page appears, you can continue with the guide.
Code
http://[deine_serverip]
For websites
A reverse proxy for websites offers many benefits, such as forwarding requests to internal server resources like a Vaultwarden instance (without a port in the URL) or forwarding them to external content, which is useful for load balancing and protection.
One major advantage is that your server can handle requests from any number of sources or domains, unlike a single web server that only runs on port 80/443.
Nginx setup
First, create an entry in the Nginx directory for the domain you selected earlier—usually a subdomain such as zapdocs.example.com in our example.
Important
Before continuing, make sure you’ve created an A record pointing to your proxy server’s IP address. Without it, the domain and everything else won’t work properly.
Switch to the server block directory with:
Code
cd /etc/nginx/sites-available/
Now create a new configuration file. We recommend using the domain name as the filename so it’s easy to find (e.g. zapdocs.example.com). Replace [your_filename] with your preferred filename.
Code
sudo nano [your_filename]
The Nano editor will open. Paste the following template into it. Replace [your_domain] with the domain you want to proxy, and [your_target_server] with the target server you want to reach.
Code
upstream targetServer {
# Füge hier den Zielserver ein, den du erreichen willst. Das kann sein:
# Interne "localhost" Weiterleitung (z.B. 127.0.0.1:9090)
# Externer Server (z.B. 103.146.43.52:9000)
server [your_target_server];
}
server {
listen 80;
listen [::]:80;
# Domain, die bedient werden soll (z.B. zapdocs.example.com)
server_name [your_domain];
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_pass_request_headers on;
proxy_http_version 1.1;
proxy_pass http://targetServer;
}
}
Once you’ve made all the changes, save the file with CTRL + X, confirm with Y, and press ENTER.
Now activate the server block by creating a symlink to the active directory:
If everything looks good, reload Nginx to apply the new configuration:
Code
systemctl reload nginx.service
Now test in your browser whether your domain loads the content you specified as targetServer. If you run into any issues, check the logs with:
Code
journalctl -f -u nginx.service
to find errors.
For game servers
A reverse proxy for game servers offers many benefits, such as an extra layer of security and greater reliability through better protection and restricted access to the main server.
Tip
Most dedicated game servers work great with the raw TCP/UDP proxy you’ll set up here. A small minority of games, such as BeamMP, may have issues with VPNs and proxies—you’ll need to test each game.
Nginx setup
For this, you’ll need the Nginx Stream module, which isn’t included in the standard Nginx installation.
Installing the Nginx Stream module
bash
sudo apt install -y libnginx-mod-stream
bash
sudo dnf -y install nginx-mod-stream
Nginx Stream configuration
Add a new stream block to the main nginx.conf file, where you define the upstream server and the port your proxy should be available on.
Open the file with:
Code
sudo nano /etc/nginx/nginx.conf
Now add the following block. Replace [your_target_server] with the server to stream to, including the port (e.g. :30120 for FiveM). Replace [your_port_listener] with the port users should use to connect to the proxy.
Code
stream {
upstream targetServer {
# Zielserver, den du erreichen willst (z.B. 103.146.43.52:30120)
server [your_target_server];
}
server {
# Port, der Verbindungen annimmt und weiterleitet (z.B. 30120)
listen [your_port_listener];
proxy_pass targetServer;
}
}
Nginx will listen on the specified port and forward all connections to the target server.
Save the file with CTRL + X, confirm with Y, and press ENTER.
Check the syntax with:
Code
sudo nginx -t
If everything looks good, reload Nginx to apply the configuration:
Code
systemctl reload nginx.service
Now test whether you can connect to your game server through the proxy domain. If you run into any issues, check the logs with:
Code
journalctl -f -u nginx.service
SSL certificate
We strongly recommend installing an SSL certificate for your domains so data is transmitted securely over HTTPS. See our Creating an SSL Certificate guide, which explains the entire process for requesting and automatically renewing SSL certificates.
Conclusion
Congratulations! You’ve successfully set up a reverse proxy for your website, your game server, or both :) You can now benefit from better security, reliability, and performance. If you have any questions or run into any issues, our support team is here to help every day! 🙂
Server hosting from €2.49 / month, online instantly, DDoS protection included.