Nginx Configuration for TruCMS

A customer-facing Nginx deployment example for TruCMS.

Nginx should use the application public directory as its root and send non-file requests to the application entry point.

server {
    listen 80;
    server_name example.com;
    root /var/www/trucms/public;
    index index.php index.html;
    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }
    location ~ \.php$ {
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_pass unix:/run/php/php8.4-fpm.sock;
    }
    location ~ /\. { deny all; }
}

PHP-FPM socket

The PHP-FPM socket path varies by server. Replace the example path with the PHP 8.4 FPM endpoint provided by your hosting environment.