我是karthik。这是我在此的头一篇博文。Nginx与cakephp - 配置问题
我有一个vps在nginx服务器上运行centos。我想要在我的网站上照相。所以我创建了一个子域名clicks.example.com。我正在使用名为whitespace cms的flash模板,它使用了cakephp。问题在于重写规则。我无法弄清根目录。
这是我的配置文件。
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;
}
}
我想我搞乱了cakephp的子域和根。任何帮助将不胜感激。我试了8个小时:)仍然没有运气。当我使用上述配置时,我得到空白页面,有时我得到一个502错误的网关错误。 更新:好吧,502错误是由于nginx的PHP-FPM问题。现在,当我访问clicks.example.com我得到重定向到发黑的CMS。 clicks.example.com/users/login .. [其实backened应clicks.example.com/fotoblog/users/login,知道我要去的地方错]
请查看我对这里的类似问题的回答:http://stackoverflow.com/questions/8088717/issue-with-cakephp-application-running-on-nginx-1-0-8-subdirectory/8092482#8092482 – wrdevos 2011-11-11 10:21:28