Posts Tagged ‘CakePHP’
NGINX config for CakePHP 1.3 (& PHP 5.4)
1 Comment | This entry was posted on May 05 2013
This afternoon I setup a virtual host in NGINX for a CakePHP 1.3.x project in readiness for starting work with a new client tomorrow. However once I had what looked correct, CakePHP would complain that friendly URLs where not setup correctly. I am running PHP 5.4.14 on my laptop and CakePHP 1.3 for the site, as this is what the current project is running.
There seems to be no examples on the web of how to get these two versions to run together. So here is my example that I got to work for anyone who’s also stuck:
server { listen 80; server_name cakephp; root /var/www/cakephp/app/webroot/; access_log /var/log/nginx/cakephp/access.log; error_log /var/log/nginx/cakephp/error.log; location / { index index.php index.html index.htm; if (-f $request_filename) { break; } if (-d $request_filename) { break; } rewrite ^(.+)$ /index.php?url=$1 last; } location ~ .*\.php[345]?$ { fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /var/www/cakephp/app/webroot$fastcgi_script_name; include fastcgi_params; } }