首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >带有cakephp的Nginx -配置问题

问带有cakephp的Nginx -配置问题
EN

Stack Overflow用户
提问于 2011-05-18 21:19:58
回答 1查看 1.6K关注 0票数 1

我是卡西克。这是我在这里的第一篇文章。

我有一个在centos和nginx服务器上运行的vps。我想在我的网站上有一个图片库。所以我创建了一个子域clicks.example.com。我使用了一个名为whitespace cms的flash模板,它使用了cakephp。问题出在重写规则上。我找不到根目录。

这是我的配置文件。

代码语言:javascript
复制
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,你知道我哪里错了吗?

EN

回答 1

Stack Overflow用户

发布于 2012-09-16 01:44:46

你没做错什么!我也有一个类似的问题,经过几个小时的研究和浪费时间,我能够解决它-我只是做了一个新的蛋糕版本的新安装,它解决了我的nginx rewrite rule issues。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/6045362

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档