title: Nginx with cakephp - configuration problem
body: <p>I am karthik. This is my first post here.</p>
  <p>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 <a href="http://www.heikowaechter.com/#/?page=template" rel="nofollow noreferrer">whitespace cms</a> which uses cakephp. The problem is with the rewrite rules. I am not able to figure out the root directory.</p>
  <p>This is my configuration file.</p>
  <pre><code>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;
      }
  }
  </code></pre>
  <p>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 use the above configuration i get blank page and sometimes i get a 502 bad gateway error.
  Update: okay, 502 errors was due to nginx php-fpm problems. now 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]</p>