I’ve been doing some work with NGINX of late and anyone familiar with CakePHP will know that it ships out of the box with Apache .htaccess files to make sure that the URL‘s are devoid of there query string.
Anyway, enough talk, if you want to host cakephp on NGINX, you’ll need to use a vhost like so:
server {
listen 80;
server_name somedomain.com;
access_log /var/www/logs/somedomain.access.log main;
error_log /var/www/logs/somedomain.error.log info;
rewrite_log on;
# rewrite rules for cakephp
location / {
root /var/www/sites/somedomain.com/current;
index index.php index.html;
# If the file exists as a static file serve it
# directly without running all
# the other rewite tests on it
if (-f $request_filename) {
break;
}
if (!-f $request_filename) {
rewrite ^/(.+)$ /index.php?url=$1 last;
break;
}
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME \
/var/www/sites/somedomain.com/current$fastcgi_script_name;
include fastcgi_params;
}
}


Hi, I am karthik.
I have a vps running on centos with nginx server. I want a photogallery on my site. so i created a subdomain clicks.example.com. I am using a flash template called whitespace cms which uses cakephp. The problem is with the rewrite rules. I am not able to figure out the root directory.
This is my configuration file.
server { listen 80; server_name clicks.example.com; access_log /home/www/example.com/logs/access.log; error_log /home/www/example.com/logs/error.log; rewrite_log on; # rewrite rules for cakephp location / { root /home/www/example.com/clicks/fotoblog/app/webroot/; index index.php index.html; # If the file exists as a static file serve it # directly without running all # the other rewite tests on it if (-f $request_filename) { break; } if (!-f $request_filename) { rewrite ^/(.+)$ /index.php?url=$1 last; break; } } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /home/www/example.com/clicks/fotoblog/app/webroot$fastcgi_script_name; include fastcgi_params; } }I think i am messing up with subdomain and root of cakephp. any help will be appreciated. I tried for 8 hours
still no luck. when i access clicks.example.com i am getting redirected to the blackened of the cms. clicks.example.com/users/login.. [actually the backened should be clicks.example.com/fotoblog/users/login, do know where i am going wrong]