Nischay's Blog

how-to-install-apache-on-ubuntu

By Nischay Sharma on Feb 5, 2020
Image post 2

·4 min read

“Pterodactyl is an open-source game server management panel built with PHP 7, React, and Go. Designed with security in mind, Pterodactyl runs all game servers in isolated Docker containers while exposing a beautiful and intuitive UI to end users.” — https://pterodactyl.io

A common issue/question I see happening frequently is running Pterodactyl behind a Cloudflare Proxy. Cloudflare will not only protect your instances IP address from the public- it is an added security benefit. In addition confusion is added when the community has no direction on how todo it — this should be documented.

Requirements

  • Linux server with Pterodactyl already setup (Daemon and panel!)
  • Cloudflare setup — read below for further instructions

This documentation is designed for a Pterodactyl front-end running Nginx as the webserver.

Setting up Cloudflare

Before continuing, please make sure you’ve setup Cloudflare and have your nameservers set.

  1. Visit Cloudflare’s DNS tab. Create a record as following, you can change the name. Please make sure you set your servers IPv4 address in the box. Make sure the proxy is enabled!

Cloudflare DNS tab

2. Creating origin certificates. Visit SSL -> Origin Certificates- click create certificate. Leave settings as is, click create.

Creating Cloudflare Certificate

3. Copy your Origin AND private key to a safe place for now.

4. Once copied and stored safely, move on.

Setting up Pterodactyl’s Frontend Panel for Cloudflare Proxy

Before moving on; verify that proxy is enabled for the domain under the DNS tab.

  1. Create a file for your private and origin key. Todo this, create a file for your origin certificate first, store these at: /etc/ssl/origin.pem Create another file for your private key: /etc/ssl/origin.key. Please copy your origin and private key you’ve copied from Cloudflare into the configs. (origin.pem contains the Origin Certificate; origin.key contains your private key)
  2. Visit your Pterodactyl reverse proxy config- this should be stored at /var/nginx/sites-available/pterodactyl.conf. Make sure your configuration is as matched. Highlighted sections describe sections needing to be edited.

NGINX config

Once you’ve saved the file- you can restart your nginx server.
systemctl restart nginx

Your Pterodactyl panel is now behind a proxy! Please note: If you have the same FQDN for your node & frontend, you will need to follow the additional steps below.

Edit Jan 6, 2022:

It is recommended that you make the following configuration edits to your .env & nginx configurations.

In your pterodactyl nginx configuration.

Locate the following section:

Paste the following from the pterodactyl website under the server block:

[

Additional Configuration | Pterodactyl

Pterodactyl Panel allows users to create backups of their servers. In order to create backups, a backup storage method…

pterodactyl.io

](https://pterodactyl.io/panel/1.0/additional_configuration.html#nginx-specific-configuration)

After, you need to edit your .env file located in /var/www/pterodactyl. Place the following line anywhere in that file.

[

Additional Configuration | Pterodactyl

Pterodactyl Panel allows users to create backups of their servers. In order to create backups, a backup storage method…

pterodactyl.io

](https://pterodactyl.io/panel/1.0/additional_configuration.html#cloudflare-specific-configuration)

Restart nginx using systemctl restart nginx.

Setting up Pterodactyl’s Wings for Cloudflare’s Proxy

Please make sure you’ve followed the steps above to generate your certificates and verify your pterodactyl frontend is working.

  1. Add your certificates (This does not need to be repeated if panel & wings are on the same server) Create a file for your private and origin key. Todo this, create a file for your origin certificate first, store these at: /etc/ssl/origin.pem Create another file for your private key: /etc/ssl/origin.key. Please copy your origin and private key you’ve copied from Cloudflare into the configs. (origin.pem contains the Origin Certificate; origin.key contains your private key)
  2. Edit your binded ports for your daemon. Visit your admin panel -> nodes -> select the node. Set your daemon port to 8443, and your SFTP port to 2053.
  3. Visit your Pterodactyl wings config, located at /etc/pterodactyl/config.yml, edit the following sections highlighted:

Daemon config

Save your file, please make sure “Behind proxy” is not enabled on your daemon. You can now reboot your wings. systemctl restart wings

You’ve now successfully installed, setup, and configured your Pterodactyl instance for Cloudflare’s proxy!

Subscribe to my Newsletters

Lorem ipsum dolor sit amet consectetur adipisicing elit. Tenetur vero esse non molestias eos excepturi, inventore atque cupiditate.

    © Copyright 2022 by Nischay's Blog. Built with ♥ by ~Nischay.