Deployment Overview of Pterodactyl Control Panel on Server¶
Prerequisites and Basic Requirements¶
The deployment of the Pterodactyl Control Panel requires a server running Ubuntu 22.04 (Jammy). The system must have root privileges to install dependencies, configure services, and manage file permissions. The following components are required:
-
Operating System: Ubuntu 22.04 (Jammy)
-
Privileges: Root access
-
Domain: A subdomain under the
hostkey.inzone -
Ports:
-
Port
80and443for web traffic (HTTP/HTTPS) -
Port
8000for internal application communication -
Port
12333for external Wings proxy access -
Port
3306for MariaDB -
Port
6379for Redis
FQDN of the Final Panel¶
The Fully Qualified Domain Name (FQDN) for the Pterodactyl panel follows the format: pterodactyl<Server ID>.hostkey.in
The application is accessible via HTTPS on port 443 and via the Wings proxy on port 12333.
File and Directory Structure¶
The application files, configuration, and data are organized in the following locations:
-
Application Root:
/var/www/pterodactyl -
Public Assets:
/var/www/pterodactyl/public -
Storage Directory:
/var/www/pterodactyl/storage -
Bootstrap Cache:
/var/www/pterodactyl/bootstrap/cache -
Nginx Configuration:
/etc/nginx/sites-available/pterodactyl.conf -
Nginx Docker Compose:
/root/nginx/compose.yml -
SSL Certificates:
/etc/letsencrypt/live/pterodactyl<Server ID>.hostkey.in -
Systemd Services:
/etc/systemd/system/pteroq.service -
Cron Jobs:
/etc/cron.d/pterodactyl
Application Installation Process¶
The Pterodactyl Panel is installed using the latest release archive from the official repository. The installation process involves the following steps:
-
System Preparation: Update the package cache and install required dependencies including
nginx,mariadb-server,redis-server,php8.2, andcomposer. -
Repository Configuration: Add the Ondrej PHP PPA and the official Redis repository to ensure the correct versions of PHP and Redis are installed.
-
Service Activation: Enable and start
php8.2-fpm,mariadb,redis-server,nginx, andcron. -
Application Deployment:
-
Download the latest
panel.tar.gzfrom GitHub. -
Extract the archive to
/var/www/pterodactyl. -
Create necessary directories (
storage,bootstrap,bootstrap/cache) and set ownership towww-data.
-
-
Dependency Installation: Run
composer installto install PHP dependencies. -
Database Initialization:
-
Configure MariaDB to set the root password.
-
Create the
paneldatabase. -
Run database migrations and seed the initial data.
-
-
User Creation: Create the first administrative user with the email, username, and password defined in the configuration.
-
Queue Worker Setup: Install and enable the
pteroqsystemd service to handle background jobs. -
Scheduler Setup: Configure a cron job to run the Laravel scheduler every minute.
Access Rights and Security¶
Security is enforced through service isolation, firewall rules, and strict file permissions.
-
Firewall: The server allows traffic on ports
80,443,8000,12333,3306, and6379. -
Users:
-
The web server and application files are owned by the
www-datauser and group. -
The
pteroqservice runs as thewww-datauser. -
The
rootuser manages system-level configurations and cron jobs. -
Restrictions:
-
Access to hidden files (starting with
.) is denied in the Nginx configuration. -
The
HTTP_PROXYenvironment variable is cleared in the PHP-FPM configuration to prevent HTTPoxy attacks. -
SSL is enforced for all web traffic.
Databases¶
The application uses a local MariaDB instance for data storage.
-
Connection Method: Localhost TCP connection.
-
Storage Location: Managed by the
mariadbservice on the host. -
Configuration:
-
Database Name:
panel -
Host:
127.0.0.1 -
Port:
3306 -
Username:
root -
Password: Defined in the system configuration.
Redis is used for caching and queue management.
-
Host:
127.0.0.1 -
Port:
6379 -
Password: Not set (null).
Docker Containers and Their Deployment¶
A Docker container is used to manage the Nginx proxy and SSL certificates via Certbot.
-
Container Image:
jonasal/nginx-certbot:latest -
Deployment Method: Docker Compose
-
Compose File Location:
/root/nginx/compose.yml -
Volumes:
-
nginx_secrets: Mounted to/etc/letsencryptfor certificate storage. -
/data/nginx/user_conf.d: Mounted to/etc/nginx/user_conf.dfor custom configurations. -
/var/www/pterodactyl/public: Mounted read-only to/var/www/pterodactyl/public. -
Network Mode: Host
-
Restart Policy:
unless-stopped
Proxy Servers¶
The deployment utilizes Nginx as a reverse proxy with SSL termination.
-
Nginx Configuration:
-
A dedicated site configuration is located at
/etc/nginx/sites-available/pterodactyl.conf. -
HTTP traffic on port
80is redirected to HTTPS. -
PHP requests are proxied to the local PHP-FPM socket at
unix:/run/php/php8.2-fpm.sock. -
SSL/TLS:
-
Certificates are obtained and managed by Certbot via the Docker container.
-
SSL is enabled for the domain
pterodactyl<Server ID>.hostkey.in. -
TLS protocols
TLSv1.2andTLSv1.3are enforced. -
Wings Proxy:
-
A separate Nginx configuration handles the Wings daemon traffic on port
12333. -
This configuration proxies requests to
http://host.docker.internal:8000. -
WebSocket support is enabled with upgrade headers.
Permission Settings¶
File and directory permissions are strictly set to ensure security and proper functionality:
-
Application Directory:
/var/www/pterodactylis owned bywww-data:www-datawith mode0755. -
Storage and Cache: Subdirectories
storage,bootstrap, andbootstrap/cacheare owned bywww-data:www-datawith mode0755. -
Nginx Configuration: Files in
/etc/nginx/sites-availableand/etc/nginx/sites-enabledare owned byroot:rootwith mode0644. -
Docker Compose: The compose file at
/root/nginx/compose.ymlis owned byroot:rootwith mode0644.
Location of Configuration Files and Data¶
Key configuration files and data locations include:
-
Environment File:
/var/www/pterodactyl/.env -
Nginx Site Config:
/etc/nginx/sites-available/pterodactyl.conf -
Wings Proxy Config: Defined within the Docker container or host Nginx configuration for port
12333. -
Systemd Service:
/etc/systemd/system/pteroq.service -
Cron Job:
/etc/cron.d/pterodactyl -
Initialization Marker:
/var/www/pterodactyl/.ansible_ptero_initialized
Available Ports for Connection¶
The following ports are configured for external and internal access:
-
Port 80: HTTP (redirects to HTTPS).
-
Port 443: HTTPS (Pterodactyl Panel).
-
Port 12333: HTTPS (Wings Proxy).
-
Port 8000: Internal application port (proxied).
-
Port 3306: MariaDB (local only).
-
Port 6379: Redis (local only).
Starting, Stopping, and Updating¶
Service management is handled via systemd for native services and docker compose for the proxy container.
Native Services:
-
Start/Stop/Restart Nginx:
-
Start/Stop/Restart MariaDB:
-
Start/Stop/Restart Redis:
-
Start/Stop/Restart PHP-FPM:
-
Start/Stop/Restart Queue Worker:
Docker Container:
- Start/Stop/Restart Nginx-Certbot:
Application Updates:
-
Clear and cache configuration:
-
Run migrations (if schema changes):