• Plesk Uservoice will be deprecated by October. Moving forward, all product feature requests and improvement suggestions will be managed through our new platform Plesk Productboard.
    To continue sharing your ideas and feedback, please visit features.plesk.com

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

Polmonino

Basic 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