救命:cakephp rewrite 问题 (nginx + fastcgi),困惑8天了
时间:2010-06-02
来源:互联网
本帖最后由 Vinsion 于 2010-06-02 03:07 编辑
需求:
有个项目用 cakephp 做的,原环境是 apache2 + php5,可以正常运行,
现在要迁移到 nginx + fastcgi ,环境已经配好(phpinfo 正常),但 cakephp
整来整去都跑不起来,
主页面(cakephp/app/webroot/index.php),可以看到,但是很粗糙,
CSS 和 图片 都不能显示,
查看图片属性:( http://images/logo.jpg )
nginx 配置:
复制代码
部分 error log:
复制代码
求各路英雄好汉出手相助,感激不尽!
需求:
有个项目用 cakephp 做的,原环境是 apache2 + php5,可以正常运行,
现在要迁移到 nginx + fastcgi ,环境已经配好(phpinfo 正常),但 cakephp
整来整去都跑不起来,
主页面(cakephp/app/webroot/index.php),可以看到,但是很粗糙,
CSS 和 图片 都不能显示,
查看图片属性:( http://images/logo.jpg )
nginx 配置:
- server {
- listen 82;
- #server_name 192.168.1.6;
-
- access_log /var/log/nginx/host.access.log main;
- rewrite_log on;
-
- root /www/cakephp/app/webroot;
-
- location / {
- index index.php index.htm index.html;
-
- if (-f $request_filename) {
- break;
- }
- if (-d $request_filename) {
- rewrite ^/(.*)$ /index.php?url=$1 last;
- break;
- }
-
- }
-
- error_page 500 502 503 504 /50x.html;
- location = /50x.html {
- root /www/;
- }
-
- location ~ \.php$ {
- fastcgi_pass 127.0.0.1:9000;
- fastcgi_index index.php;
- fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
- include /etc/nginx/fastcgi_params;
- #fastcgi_param SCRIPT_FILENAME /www/cakephp/app/webroot$fastcgi_script_name;
- #fastcgi_param SERVER_NAME $host;
- #fastcgi_param SERVER_NAME $server_name;
- }
-
- location ~ /(\.ht|\.git|\.svn) {
- deny all;
- }
-
- }
- 2010/06/01 02:01:28 [notice] 1961#0: *1 "^/(.*)$" matches "/", client: 192.168.1.249, server: openwrt, request: "GET / HTTP/1.1", host: "192.168.1.6:82"
-
- 2010/06/01 02:01:28 [notice] 1961#0: *1 rewritten data: "/index.php", args: "url=", client: 192.168.1.249, server: openwrt, request: "GET / HTTP/1.1", host: "192.168.1.6:82"
-
- 2010/06/01 02:02:53 [notice] 1961#0: *3 "^/(.*)$" matches "/", client: 192.168.1.249, server: openwrt, request: "GET / HTTP/1.1", host: "192.168.1.6:82"
-
- 2010/06/01 02:02:53 [notice] 1961#0: *3 rewritten data: "/index.php", args: "url=", client: 192.168.1.249, server: openwrt, request: "GET / HTTP/1.1", host: "192.168.1.6:82"
-
- 2010/06/01 02:03:06 [notice] 1961#0: *5 "^/(.*)$" matches "/", client: 192.168.1.249, server: openwrt, request: "GET / HTTP/1.1", host: "192.168.1.6:82"
-
- 2010/06/01 02:03:06 [notice] 1961#0: *5 rewritten data: "/index.php", args: "url=", client: 192.168.1.249, server: openwrt, request: "GET / HTTP/1.1", host: "192.168.1.6:82"
-
- 2010/06/01 02:03:51 [error] 1961#0: *3 open() "/www/cakephp/app/webroot/users/login" failed (2: No such file or directory), client: 192.168.1.249, server: openwrt, request: "POST /users/login HTTP/1.1", host: "192.168.1.6:82", referrer: "http://192.168.1.6:82/"
作者: Vinsion 发布时间: 2010-06-02
不懂cakephp
听说cakephp已经die了。
听说cakephp已经die了。
作者: maochanglu 发布时间: 2010-06-02
location / {
index index.php index.htm index.html;
...
}
加入root试试,或许能显示CSS和图片
index index.php index.htm index.html;
...
}
加入root试试,或许能显示CSS和图片
作者: ylzsxdgqs 发布时间: 2010-06-02
QUOTE:
location / {
index index.php index.htm index.html;
...
}
加入root试试,或许能显示CSS和图片
ylzsxdgqs 发表于 2010-06-02 10:43
index index.php index.htm index.html;
...
}
加入root试试,或许能显示CSS和图片
ylzsxdgqs 发表于 2010-06-02 10:43
谢谢 ylzsxdgqs 的帮助,把 root 从 server 调到 location 下面,在这之前也试过,不行:
- server {
- listen 82;
- #server_name 192.168.1.6;
- access_log /var/log/nginx/host.access.log main;
- rewrite_log on;
-
- location / {
- index index.php index.htm index.html;
- root /www/cakephp/app/webroot;
作者: Vinsion 发布时间: 2010-06-02
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28