Running Symfony2 on ISPConfig3 Running Symfony2 on ISPConfig3 symfony symfony

Running Symfony2 on ISPConfig3


The configuration is missing the actual relaying to PHP. It should work if you exchange the location @php block with the following three blocks:

location / {  try_files $uri @php;}location app.php {  try_files @php =404;}location @php {    include /etc/nginx/fastcgi_params;    fastcgi_pass unix:/var/lib/php5-fpm/web3.sock;    fastcgi_param  SCRIPT_NAME  app.php;    fastcgi_param  SCRIPT_FILENAME  app.php;    fastcgi_intercept_errors on;}

The first block tries to find the requested file in the given root directory, meaning /var/www/mydomain.tld/web - now all Symfony assets will work and be returned, because they are all in the web directory. If the file is not found, it calls PHP.

The second block is used if /app.php is requested directly - instead of delivering that file, we process it with PHP.

The third block configures PHP - the previous two blocks always refer to this block, so any file not directly found is processed by PHP. Symfony only has one front controller, app.php, so we just send all requests to that entry point.

With this setup, it should be quite secure, because only app.php is ever processed by PHP. For a testing environment, you can use app_dev.php instead of app.php (just change the filename in the @php block) - but never for production and without securing the testing environment.


Try pasting the code into the nginx Directives field on the Options tab of the website in ISPConfig. This should save your settings while config regenerations.