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:
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?
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?