Forked from TheDevFreak/!Running Pterodactyl (Panel & Wings) Behind and NGINX Reverse Proxy
Created
July 23, 2023 04:56
-
-
Save regix1/e429111127ff0967f992540ca4818d69 to your computer and use it in GitHub Desktop.
Pterodactyl Panel Behind an NGINX Reverse Proxy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Your panel should run on port 80 (well whatever you want I suppose) | |
Node daemon port should be 443 (but still http) because it hard codes those ports into connection urls for websockets in the webui :/ | |
Ensure you have `TRUSTED_PROXIES=proxyip` in your `/var/www/pterodactyl/.env` file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 443 ssl; | |
ssl on; | |
ssl_certificate /path/to/cert/fullchain.pem; | |
ssl_certificate_key /path/to/cert/key.pem; | |
server_name panel.domain.tld; | |
location / { | |
proxy_pass http://PANELIP_should_be_port_80/; | |
proxy_set_header Host $host; | |
client_max_body_size 50m; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header Host $host; | |
proxy_set_header X-Forwarded-Proto $scheme; | |
proxy_redirect off; | |
proxy_buffering off; | |
proxy_request_buffering off; | |
} | |
} | |
server { | |
listen 443 ssl; | |
ssl on; | |
ssl_certificate /path/to/cert/fullchain.pem; | |
ssl_certificate_key /path/to/cert/key.pem; | |
server_name node1.domain.tld; | |
location ~ ^\/api\/servers\/(?<serverid>.*)?\/ws$ { | |
proxy_pass http://node_ip:443/api/servers/$serverid/ws; | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection "upgrade"; | |
proxy_set_header Host $host; | |
client_max_body_size 50m; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-Proto $scheme; | |
proxy_redirect off; | |
proxy_buffering off; | |
proxy_request_buffering off; | |
} | |
location / { | |
proxy_pass http://node_ip:443/; | |
proxy_set_header Host $host; | |
client_max_body_size 50m; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-Proto $scheme; | |
proxy_redirect off; | |
proxy_buffering off; | |
proxy_request_buffering off; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm going to post screenshots for anyone struggling. A lot has changed since this was posted.
I did not leave my FQDN blank, I set it to my node domain name. node1.domain.com
This is my general configuration:
Inside of my /etc/pterodactyl/config.yml
I changed:
api:
host: Internal IP of Server from Wings not 0.0.0.0
port: 443
You can change these inside of the panel too I just had trouble doing so. You can find your internal server ip on linux with "ip a"
Nginx Config: