nginx无法解析子目录php文件,无法显示图片。求助,3Q

wangjj530 发布于 2011/05/29 09:44
阅读 4K+
收藏 1
好多天了。找不个头绪。来这里问问nginx前辈们。3Q。
具体描述:
我的站点环境 : web服务器 图片服务器 两台。 站点根目录 /xxx/www/domain.com/public/ 站点图片文件统一放在images/下面。 站点图片在第一次访问的时候会判断,如果图片不存在,就读取images/imageserver/xxx.php文件,然后就去图片服务器下载,放在图片目录。

现在的情况是:图片无法显示,如果我把图片全部直接放在images文件夹,显示正常。 否则图片无法显示(也就是没有去图片服务器下载图片),直接访问图片地址,显示No input file specified. 我的判断是没有能读取imageserver文件夹下的php文件。但是我始终无法解决。 望前辈们给予指点。3Q啦。

images内部文件包括
.
`-- imageserver
|-- client.php
|-- etc
| `-- client.settings.php
`-- lib
`-- hello.php


我的虚拟主机配置如下。

server
{
listen 80;
server_name domain.com;
index index.html index.htm index.php;
root /xxx/www/domain.com/public;
access_log /xxx/logs/domain_log access;

location / {

if (!-e $request_filename) {
rewrite sale/all$ index.php?q=sale/list last;
rewrite sale/all-([0-9]+)\.html$ index.php?q=pages/list&page=$1 last;
rewrite pages-([a-zA-Z0-9\-\_]+)-([0-9]+)\.html$ index.php?q=news/view&action=$1&aid=$2 last;
rewrite new_pages-([0-9]+)\.html$ index.php?q=new_arrivals&page-$1 last;
rewrite pages/list-([0-9]+)\.html$ index.php?q=pages/list&page=$1 last;
rewrite ([a-zA-Z0-9\-\_]+books)-([0-9]+)\.html$ index.php?q=books/list&cate_name=$1&page=$2 last;
rewrite ([a-zA-Z0-9]+)-([0-9]+)\.html$ index.php?q=books/view&action=$1&itemno=$2 last;
rewrite ([a-zA-Z0-9\-\_]+books)\.html$ index.php?q=books/list&cate_name=$1? last;
rewrite search_(.*)_(.*)\.html$ index.php?q=procduct/list&search_type=$1&keyword=$2 last;
}
if (!-e $request_filename) {
rewrite ^(.*)$ index.php?q=$1 last;
}

}
location ^~ /images/ {
if (!-e $request_filename){
rewrite ^(.*)$ imageserver/client.php?file=$1 last;
}
}
location ~ .*\.(php|php5)?$
{
fastcgi_pass 127.0.0.1:9999;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /xxx/www/domain.com/public/$fastcgi_script_name;
include fastcgi_params;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 120d;
}
location ~ .*\.(js|css)?$
{
expires 1h;
}

}
加载中
0
pizigou
pizigou
location ^~ /images/ { 
if (!-e $request_filename){ 
rewrite ^(.*)$ /images/imageserver/client.php?file=$1 last; 

试试

0
w
wangjj530

谢谢pizigou。

按照你的方法,还是不行。

0
Hell_O
Hell_O
确定php-cgi正常运行吗?
0
pizigou
pizigou
把NGINX 日志晒下哈
OSCHINA
登录后可查看更多优质内容
返回顶部
顶部