Skip to content

Nginx listen directive error on Pterodactyl Egg (Nextcloud Configuration) #94

Description

@Aulsc

Hello,

I am running into an Nginx configuration error on a Pterodactyl panel using an Nginx/PHP-FPM Egg. Although the startup script seems to run successfully, Nginx fails to load the configuration file, preventing the web server from starting correctly.

Error Details
The Pterodactyl Daemon and the start.sh script execute without apparent issues, but the Nginx check immediately fails afterwards.

Terminal Output:

[Pterodactyl Daemon]: Updating process configuration files...
[Pterodactyl Daemon]: Ensuring file permissions are set correctly, this could take a few seconds...
container@nookure~ Server marked as starting...
[Pterodactyl Daemon]: Pulling Docker container image, this could take a few minutes to complete...
Pulling from sigma-production/nginx-ptero
Digest: sha256:2aee032662aabf23741911ecf9b0fca2a92936af06f89ad8de3abfca55112b26
Status: Image is up to date for ghcr.io/sigma-production/nginx-ptero:8.4
[Pterodactyl Daemon]: Finished pulling Docker container image
:/home/container$ ./start.sh
⏳ Cleaning up temporary files...
[SUCCESS] Temporary files removed successfully.
⏳ Starting PHP-FPM...
[SUCCESS] PHP-FPM started successfully.
⏳ Starting Nginx...
[SUCCESS] Web server is running. All services started successfully.
container@nookure~ Server marked as running...
nginx: [emerg] directive "listen" is not terminated by ";" in /home/container/nginx/conf.d/nextcloud.conf:17

The key error is: nginx: [emerg] directive "listen" is not terminated by ";" in /home/container/nginx/conf.d/nextcloud.conf:17

Configuration File

Nginx configuration for Nextcloud

Based on the official recommendations

Set max upload size

client_max_body_size 10G;
fastcgi_buffers 64 4K;

Specify mapping for mjs files

types {
application/javascript mjs;
}

HSTS - Enable this after you have confirmed HTTPS is working

add_header Strict-Transport-Security "max-age=15552000; includeSubDomains" always;

server {
listen {{server.allocations.default.port}} default_server;
server_name _;

root /home/container/webroot;
index index.php index.html;

# Return 404 for all other files not matching the patterns below
location ~ ^/(?:build|tests|config|lib|3rdparty|templates)/ {
    return 404;
}
location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) {
    return 404;
}

# Deny access to sensitive files and directories
location ~ ^/(data|config|\.ht|db_structure\.xml|README) {
    deny all;
}

# Handle .well-known URLs for CalDAV and CardDAV
location /.well-known/carddav {
    return 301 $scheme://$host/remote.php/dav;
}
location /.well-known/caldav {
    return 301 $scheme://$host/remote.php/dav;
}

# Main location block
location / {
    try_files $uri $uri/ /index.php$is_args$args;
}

# PHP-FPM configuration
location ~ \.php(?:$|/) {
    fastcgi_split_path_info ^(.+?\.php)(/.*)$;
    set $path_info $fastcgi_path_info;
    
    try_files $fastcgi_script_name =404;
    
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param PATH_INFO $path_info;
    fastcgi_param modHeadersAvailable true; # For modern headers
    fastcgi_param front_controller_active true;
    
    # Connect to PHP-FPM service (usually on port 9000 for these images)
    fastcgi_pass 127.0.0.1:9000;
    
    fastcgi_intercept_errors on;
    fastcgi_request_buffering off;
}

}

Any help in resolving this configuration issue would be greatly appreciated.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions