# How to Optimize Pterodactyl

How to Optimize Pterodactyl – Server administration and Linux knowledge from NexoraHost.

This guide shows you how to optimize your Pterodactyl installation after setup. With these settings the panel runs faster, Wings consumes fewer resources and your game servers benefit from better performance.

**Note:** Detailed subpages on individual optimizations can be found in the left navigation.

## 1. Optimize Wings

### Limit Docker network to IPv4

By default, Docker uses both IPv4 and IPv6. If you don't need IPv6, disable it in the Wings configuration:

`nano /etc/pterodactyl/config.yml`
Find the `docker.network` section and set:

`docker:
  network:
    interfaces:
      v4:
        subnet: 172.20.0.0/16
        gateway: 172.20.0.1
    enable_ipv6: false`
This reduces overhead and prevents IPv6-related issues.

### Limit container logs

Docker containers store unlimited logs by default – this can quickly eat up several GB. Limit log size in `/etc/docker/daemon.json`:

`{
  "log-driver": "json-file",
  "log-opts": {
    "max-size": "50m",
    "max-file": "3"
  }
}`
Then restart Docker:

`systemctl restart docker`

### Disable Wings debug mode

In production, Wings should not run in debug mode. Check if debug mode is on:

`cat /etc/systemd/system/wings.service | grep -i debug`
If yes, remove `--debug` from the service file and reload systemd:

`systemctl daemon-reload
systemctl restart wings`

## 2. Improve Panel Performance

### Optimize Redis cache

Redis stores session data and cache. Make sure Redis is running and has enough RAM assigned:

`nano /etc/redis/redis.conf`
Set `maxmemory` to 256 MB or more:

`maxmemory 256mb
maxmemory-policy allkeys-lru`
Restart Redis: `systemctl restart redis`

### Enable PHP OPcache

OPcache stores compiled PHP code and significantly speeds up the panel. Check if OPcache is active:

`php -i | grep opcache.enable`
If not, install and enable it:

`apt install php8.1-opcache -y`

### Nginx caching for static files

Edit the panel's Nginx configuration:

`nano /etc/nginx/sites-enabled/pterodactyl.conf`
Add inside the `server` block:

`location ~* \.(jpg|jpeg|png|gif|ico|css|js|svg|woff|woff2|ttf|eot)$ {
    expires 30d;
    add_header Cache-Control "public, immutable";
}`
Restart Nginx: `systemctl restart nginx`

## 3. Boost Game Server Performance

### CPU pinning for important servers

You can assign dedicated CPU cores to specific game servers so other containers don't block them. In the server settings under **Build Configuration → CPU Pinning** you can assign cores, e.g. `0,1` for the first two cores.

### Set sensible RAM limits

Don't give each game server more RAM than necessary. A Minecraft server with 10 players doesn't need 16 GB – 4 GB is usually enough. Unnecessarily high RAM allocations waste resources and can slow down the host.

### Disable swap for containers

In the Wings configuration you can disable swap for containers. This prevents game servers from falling back to slow disk:

`nano /etc/pterodactyl/config.yml`
In the `docker` section add:

`container:
  swap: 0`

## 4. Optimize Database

### MariaDB/MySQL tuning

Edit the database configuration:

`nano /etc/mysql/mariadb.conf.d/50-server.cnf`
Add or adjust:

`[mysqld]
query_cache_size = 64M
query_cache_limit = 2M
innodb_buffer_pool_size = 256M
innodb_log_file_size = 64M
max_connections = 200`
Restart database: `systemctl restart mariadb`

### Regularly delete old tasks

Pterodactyl stores completed tasks in the database. These can accumulate thousands of entries over time. Delete tasks older than 30 days:

`mysql -u root -p
USE panel;
DELETE FROM tasks WHERE created_at 
Set up as cronjob (once per month):

`0 3 1 * * mysql -u root -pYourPassword panel -e "DELETE FROM tasks WHERE created_at 

## 5. Save Disk Space

### Clean up Docker images

Old Docker images accumulate and take up storage space. Run regularly:

`docker image prune -a -f`

### Remove unused Docker volumes

`docker volume prune -f`

### Delete old backups

Pterodactyl backups are located under `/var/lib/pterodactyl/backups/`. Delete backups older than 7 days:

`find /var/lib/pterodactyl/backups/ -type f -mtime +7 -delete`

## 6. Set Up Automatic Restarts

Restart Wings daily to fix memory leaks and keep Docker containers clean:

`0 4 * * * systemctl restart wings`
Set up in the root user's crontab:

`crontab -e`

## 7. Quick Checklist

    - Wings: Disable IPv6 if not needed
- Docker: Limit container logs to 50 MB
- Redis: Set maxmemory to 256 MB
- PHP: Enable OPcache
- Nginx: Set up caching for static files
- Game servers: Set CPU pinning and sensible RAM limits
- Database: Adjust innodb_buffer_pool_size, delete old tasks
- Storage: Regularly clean up Docker images and old backups
- Restart Wings daily against memory leaks

*Detailed guides on each point can be found in the articles in the left navigation.*

→ [Pterodactyl installation](/en/server-panels/pterodactyl/install) · [Server lagging](/en/root-v-server/lagging) · [Tune root server](/en/root-v-server/root-server-optimal-konfigurieren)
