• Introducing WebPros Cloud - a fully managed infrastructure platform purpose-built to simplify the deployment of WebPros products !  WebPros Cloud enables you to easily deliver WebPros solutions — without the complexity of managing the infrastructure.
    Join the pilot program today!
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.

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