Skip to content

An extension for Pterodactyl Panel to reverse proxy servers without clutter...

Notifications You must be signed in to change notification settings

kragleh/pterotunnel

Repository files navigation

PteroTunnel

An Nginx manager built using Next.js 13 & Tailwind CSS that lets you easily reverse proxy your Pterodactyl Panel servers using a normal proxy or a secure one

Getting Started

This project is in its early stages and shouldn't be used in production! This should be installed on every node that you would like to reverse proxy so the traffic is as secure as it can be. Please install and run this as a root user to prevent issues.

Install Dependencies

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
nvm install 18
npm use 18
sudo apt-get install nginx

Create The Website Directory

mkdir /var/www/pterotunnel
cd /var/www/pterotunnel

Install The Latest Release

curl -Lo pterotunnel.zip https://github.com/kragleh/pterotunnel/releases/latest/download/pterotunnel.zip
unzip pterotunnel.zip

Edit .env

cp .env.example .env
nano .env

Warning! Dont use an url with / at the end of it!

panel - Is your Pterodactyl panel url Ex: https://panel.example.host

tunnel - Is the url you are accessing this from Ex: https://tunnel-node.example.host

Install Required Node Modules

npm install

Build The Website

npm run build

Run it Non-Stop using pm2

npm install -g pm2

pm2 start npm --name pterotunnel -- run start

pm2 save

pm2 startup

Setup Nginx Reverse Proxy For HTTPS

nano /etc/nginx/sites-enabled/pterotunnel.conf

Paste this below to the nginx configuration file and replace %domain% with your domain

server {
  listen 80;
  server_name %domain%;
  return 301 https://$server_name$request_uri;
}

server {
  listen 443 ssl http2;
  server_name %domain%;

  ssl_certificate /var/www/pterotunnel/ssl/tunnel/proxy.crt;
  ssl_certificate_key /var/www/pterotunnel/ssl/tunnel/proxy.key;

  location / {
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_pass http://localhost:8888;
  }
}

Add your certificate using these commands

# For certificate
nano /var/www/pterotunnel/ssl/tunnel/proxy.crt
# For key
nano /var/www/pterotunnel/ssl/tunnel/proxy.key

Restart nginx to apply changes

systemctl restart nginx