• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion
  • Please beaware of a breaking change in the REST API on the next Plesk release (18.0.62).
    Starting from Plesk Obsidian 18.0.62, requests to REST API containing the Content-Type header with a media-type directive other than “application/json” will result in the HTTP “415 Unsupported Media Type” client error response code. Read more here

How to create a custom template for nginx & PHP-FPM for "special" websites?

Polmonino

New Pleskian
I manly use Symfony 2 as PHP framework. It works without problems with Apache/FastCGI. I'd like to use it with nginx/PHP-FM for low memory usage and high performance (Zend OPCache).

However, Plesk-generated default nginx configuraton is not suitable for Symfony 2. This is a minimal working configuration:

Code:
server {
    server_name domain.tld www.domain.tld;
    root /var/www/project/web;

    location / {
        # prova a servire direttamente i file, fallback su riscrittura
        try_files $uri @rewriteapp;
    }

    location @rewriteapp {
        # riscrittura di tutto su app.php
        rewrite ^(.*)$ /app.php/$1 last;
    }

    location ~ ^/(app|app_dev|config)\.php(/|$) {
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_split_path_info ^(.+\.php)(/.*)$;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param HTTPS off;
    }

    error_log /var/log/nginx/project_error.log;
    access_log /var/log/nginx/project_access.log;
}

I cannot use the / location because generated nginx configuration already defines / (you'll get an error if you try to paste the location in additional nginx directives). So, how can I use a custom nginx.conf for "special" project like Symfony 2? Is there any way to define a custom template (like nginxDomainVirtualHostSymfony.php) and select it from Plesk web interface?
 
Back
Top