我是卡西克。这是我在这里的第一篇文章。
我有一个在centos和nginx服务器上运行的vps。我想在我的网站上有一个图片库。所以我创建了一个子域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的黑屏。单击.example.com/users/login..实际上后端应该是clicks.example.com/fotoblog/users/login,你知道我哪里错了吗?
发布于 2012-09-16 01:44:46
你没做错什么!我也有一个类似的问题,经过几个小时的研究和浪费时间,我能够解决它-我只是做了一个新的蛋糕版本的新安装,它解决了我的nginx rewrite rule issues。
https://stackoverflow.com/questions/6045362
复制相似问题