Skip to content
  • About
  • Contact
  • Docs
  • Features
  • Home

Configurations

5
  • Setup RAID Level 6
  • Setup RAID Level 5
  • How To Add Swap on RHEL or Centos based system
  • Website Migration to Non-Panel OpenLiteSpeed Server
  • Linux Server Performance Tuning

CyberPanel

9
  • Mounting /tmp on a Separate File
  • Updating CyberPanel Main VirtualHost Configuration
  • Updating CyberPanel vHosts Configuration
  • How to Change CLI PHP on CyberPanel
  • How to Update PHP Version to 8.1 in CyberPanel (From 7.3, 7.4, or 8.0)
  • CyberPanel Server Cleanup: Logs, Dumps, Backups
  • CyberPanel Full LSPHP Installation PHP 7.4 – 8.3
  • CyberPanel / OpenLiteSpeed: Clean LSPHP Session Files
  • SSL Certificate Management in CyberPanel via SSH

Hestia Control Panel

6
  • Fixing Email Bounce Back Issue in Hestia (Exim4 Blacklist Rejection)
  • Managing Fail2Ban in HestiaCP Server
  • Installing and Configuring PHP Versions in HestiaCP
  • phpMyAdmin Not Found in HestiaCP
  • Setting Up a Reverse Proxy for any Port in HestiaCP
  • How to Install Let’s Encrypt SSL in Hestia CP (Hostname, Admin Panel, and Email Server)

WHM/cPanel

6
  • Setting Up a Reverse Proxy on cPanel/WHM for Port 8081
  • How to increase the size of the cPanel-generated /tmp filesystem
  • Installing Old PHP Versions on a cPanel/WHM Server
  • Fixing “550: Your Country is Not Allowed to Connect to This Server” Error in Exim (cPanel)
  • Enable WP-CLI in CageFS on CloudLinux Servers (WHM/cPanel)
  • Securing /tmp and /var/tmp with a Dedicated Loopback Filesystem

Nagios

5
  • Service Checks
  • Uptime Checks
  • Disk Space Checks
  • Load Checks
  • Email Related Checks

WordPress

3
  • WordPress Core Reinstallation Guide
  • Managing WordPress Users via WP-CLI
  • Website Duplication, Migration, or Domain Change

Operating System

1
  • Server Reboot (RHEL or Centos based system)

AWS

1
  • How to Resize EBS Volumes on AWS

Databases

2
  • MySQL
    • Optimizing MySQL Performance
    • Recovering MySQL in Plesk When InnoDB Crashes

CloudLinux

4
  • Moving cagefs-skeleton directory
  • Enable WP-CLI in CageFS on CloudLinux Servers (WHM/cPanel)
  • Enable bc in CageFS on CloudLinux Servers(WHM/cPanel)
  • How to Upgrade MySQL 5.x to MySQL 8.0 on CloudLinux (WHM server) with MySQL Governor

Cloudflare

1
  • Configuring Security Headers in Cloudflare

ISPmanager

1
  • Install Free SSL (Let’s Encrypt) for domain.tld on ISPmanager with NGINX

Plesk

1
  • Plesk Admin Login Blocked – IP Restriction Recovery Guide

VPN

4
  • Install OpenVPN Open Source in Linux CentOS Ubuntu Debian Servers
  • Protected: OpenVPN Installation & Fix Wiki (CloudLinux / CentOS 7 & 8)
  • Outline VPN Installation & Management Guide
  • Installing AdGuard Home on Debian/Ubuntu (Docker)
View Categories
  • Home
  • Docs
  • Hestia Control Panel
  • Setting Up a Reverse Proxy for any Port in HestiaCP

Setting Up a Reverse Proxy for any Port in HestiaCP

🌐 HestiaCP Reverse Proxy Configuration (Port 4000 Example)

This guide explains how to configure HestiaCP to proxy traffic from your domain to a service running on port 4000 using Nginx reverse proxy templates.

You can do this in 3 different ways:

πŸ“– Methods Overview

πŸ“ Method 1: Manual Creation
πŸ”„ Method 2: Copy & Modify Existing Template
⚑ Method 3: Automatic Bash Script

πŸ‘‰ Click the method above to jump to it.

πŸ“ Manual Template Creation

This method creates new proxy templates for HTTP and HTTPS manually.

Β Check for Existing Proxy Templates
ls /usr/local/hestia/data/templates/web/nginx | grep proxy
  • ls lists files in the Nginx template directory.
  • grep proxy filters the list to show only files containing proxy.
  • This lets you know if a template like proxy3000 or proxy[PORT_NUMBER] Β already exists.
  • If found, you might prefer Method 2 if not, or continue with Method 1.
Create HTTP Template
cd /usr/local/hestia/data/templates/web/nginx

vim proxy4000.tpl
  • cd changes the directory to where Nginx templates are stored.
  • vim opens a new file called proxy4000.tplΒ for editing.

Paste the following content:

##### HTTP Reverse Proxy Template - Port 4000 ##########

server {
    listen      %ip%:%proxy_port%;
    server_name %domain_idn% %alias_idn%;

    include %home%/%user%/conf/web/%domain%/nginx.forcessl.conf*;

    location = /favicon.ico { access_log off; log_not_found off; }

    # Maximum file upload size.
    client_max_body_size 6400M;

    location / {
        proxy_pass  http://127.0.0.1:4000;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-Proto https;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_http_version 1.1;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
        proxy_pass_request_headers on;
    }

    location /error/ {
        alias   %home%/%user%/web/%domain%/document_errors/;
    }

    location @fallback {
        proxy_pass      http://%ip%:%web_port%;
    }

    location ~ /\.ht    {return 404;}
    location ~ /\.svn/  {return 404;}
    location ~ /\.git/  {return 404;}
    location ~ /\.hg/   {return 404;}
    location ~ /\.bzr/  {return 404;}

    include %home%/%user%/conf/web/%domain%/nginx.conf_*;
}

##### HTTP Reverse Proxy Template - Port 4000 ##########
  • This config listens on %proxy_port% and forwards all traffic to http://%ip%:4000.
  • Blocks access to hidden files like .git or .htaccess.
  • Handles favicon requests and large file uploads.
Create HTTPS Template
vim /usr/local/hestia/data/templates/web/nginx/proxy4000.stpl
  • Opens a new file for HTTPS reverse proxy.
  • The .stpl extension is used by HestiaCP for SSL templates.

Paste the following content:

##### HTTPS Reverse Proxy Template - Port 4000 ##########

server {
    listen      %ip%:%proxy_ssl_port% ssl http2;
    server_name %domain_idn% %alias_idn%;
    ssl_certificate      %ssl_pem%;
    ssl_certificate_key  %ssl_key%;
    ssl_stapling on;
    ssl_stapling_verify on;
    error_log  /var/log/%web_system%/domains/%domain%.error.log error;

    include %home%/%user%/conf/web/%domain%/nginx.hsts.conf*;

    # Maximum file upload size.
    client_max_body_size 6400M;

    # Enable content compression for text types.
    gzip on;
    gzip_types text/plain text/css application/x-javascript image/svg+xml;
    gzip_comp_level 1;
    gzip_disable msie6;
    gzip_http_version 1.0;
    gzip_proxied any;
    gzip_vary on;

    location = /favicon.ico { access_log off; log_not_found off; }

    location / {
        proxy_pass  http://127.0.0.1:4000;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-Proto https;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_http_version 1.1;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
        proxy_pass_request_headers on;
    }

    location /error/ {
        alias   %home%/%user%/web/%domain%/document_errors/;
    }

    location @fallback {
        proxy_pass      https://%ip%:%web_ssl_port%;
    }

    location ~ /\.ht    {return 404;}
    location ~ /\.svn/  {return 404;}
    location ~ /\.git/  {return 404;}
    location ~ /\.hg/   {return 404;}
    location ~ /\.bzr/  {return 404;}

    include %home%/%user%/conf/web/%domain%/nginx.ssl.conf_*;
}

########## HTTPS Reverse Proxy Template - Port 4000 ##########
  • Same as HTTP, but adds SSL certificates and HTTP/2 support.
  • Enables gzip compression for better performance.
Correct Permissions
chmod 755 /usr/local/hestia/data/templates/web/nginx/proxy4000.tpl
chmod 755 /usr/local/hestia/data/templates/web/nginx/proxy4000.stpl
  • Sets permissions to allow HestiaCP and Nginx to read and execute the templates.
Restart Nginx and Apply Changes
systemctl restart nginx
v-rebuild-web-domains admin
  • systemctl restart nginx` reloads Nginx to apply new templates.
  • v-rebuild-web-domains admin` rebuilds all domains for the admin user to apply the new proxy template.

βœ… Done! HTTP and HTTPS templates are ready.

πŸ”„Β  Copy & Modify Existing Template
Copy Existing Template
cp -prf /usr/local/hestia/data/templates/web/nginx/proxy3000.tpl /usr/local/hestia/data/templates/web/nginx/proxy4000.tpl
cp -prf /usr/local/hestia/data/templates/web/nginx/proxy3000.stpl /usr/local/hestia/data/templates/web/nginx/proxy4000.stpl

Copies existing templates to create new ones for port 4000.

Replace Values
sed -i 's/3000/4000/g' /usr/local/hestia/data/templates/web/nginx/proxy4000.tpl
sed -i 's/3000/4000/g' /usr/local/hestia/data/templates/web/nginx/proxy4000.stpl

Replaces all instances of 3000 with 4000 inside the copied files.

Correct Permissions
chmod 755 /usr/local/hestia/data/templates/web/nginx/proxy4000.tpl
chmod 755 /usr/local/hestia/data/templates/web/nginx/proxy4000.stpl
Restart & Rebuild
systemctl restart nginx
v-rebuild-web-domains admin
  • systemctl restart nginx` reloads Nginx to apply new templates.
  • v-rebuild-web-domains admin` rebuilds all domains for the admin user to apply the new proxy template.

βœ… Done! HTTP and HTTPS templates are ready.

⚑ Automatic Bash Script
One-Line Command
wget -qO- https://panelwebhosting.org/hcp/RProxy.sh | bash -s -- PORT_NUMBER
wget -qO- https://panelwebhosting.org/hcp/RProxy.sh | bash -s -- 4000
  • Downloads and runs the script to automatically create proxy templates for port 4000.
Manual Download & Run
cd /usr/src
wget https://panelwebhosting.org/hcp/RProxy.sh
chmod +x RProxy.sh
bash RProxy.sh
  • Downloads the script to /usr/src, makes it executable, and runs it.
🌐 Apply Proxy Template in HestiaCP

1. Log in to HestiaCP
2. Go to Web β†’ Edit Domain
3. Under Proxy Template, select proxy4000
4. Click Save

πŸ”Ž Verify Setup
tail -f /var/log/nginx/error.log

Watches Nginx error logs for any issues while testing the domain.

phpMyAdmin Not Found in HestiaCPHow to Install Let’s Encrypt SSL in Hestia CP (Hostname, Admin Panel, and Email Server)
Table of Contents
  • πŸ“– Methods Overview
  • πŸ“ Manual Template Creation
    • Β Check for Existing Proxy Templates
    • Create HTTP Template
    • Create HTTPS Template
    • Correct Permissions
    • Restart Nginx and Apply Changes
  • πŸ”„Β  Copy & Modify Existing Template
    • Copy Existing Template
    • Replace Values
    • Correct Permissions
    • Restart & Rebuild
  • ⚑ Automatic Bash Script
    • One-Line Command
    • Manual Download & Run
  • 🌐 Apply Proxy Template in HestiaCP
    • πŸ”Ž Verify Setup

Share This Article :

  • Facebook
  • X
  • LinkedIn
  • Pinterest

Was it helpful ?

  • Happy
  • Normal
  • Sad
  • About
  • Contact
  • Docs
  • Features
  • Home

© 2026 Panel Web Hosting

  • About
  • Contact
  • Docs
  • Features
  • Home