nginx php访问图片不显示,nginx 不能读取图片。万般无奈来求助

这几天忙,没有顾的上这个事情。今天来看了下。都这么多人回复了。谢谢了。

现在可以确定 location ^~ /images/ 这里面的rewrite写错了。应该写成

rewrite ^/images/(.*)$  /images/imageserver/client.php?file=$1;

但是现在新的问题来了

server

{

listen  80;

server_name     www.domain.com;

index  index.php index.html index.htm;

root /www/html/domain.com/public;

access_log /www/logs/access/domain.com_log access;

error_log /www/logs/error/domain.com_error.log notice;

location / {

if (!-e $request_filename) {

rewrite sales/all$ index.php?q=sales/list last;

rewrite sales/all-([0-9]+)\.html$ index.php?q=sales/list&page=$1 last;

rewrite news-([a-zA-Z0-9\-\_]+)-([0-9]+)\.html$ index.php?q=news/view&action=$1&aid=$2 last;

rewrite new_arrivals-([0-9]+)\.html$ index.php?q=new_arrivals&page-$1 last;

rewrite news/list-([0-9]+)\.html$ index.php?q=news/list&page=$1 last;

rewrite ([a-zA-Z0-9\-\_]+watches)-([0-9]+)\.html$ index.php?q=sales/list&cate_name=$1&page=$2 last;

rewrite ([a-zA-Z0-9]+)-([0-9]+)\.html$ index.php?q=sales/view&action=$1&itemno=$2 last;

rewrite ([a-zA-Z0-9\-\_]+watches)\.html$ index.php?q=sales/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,在lamp环境下原来是写在/www/html/domain.com/public/images/.htaccess里面的。现在nginx下,我写成这样子,

//结果 /images/imageserver/client.php这个文件不解析。所以不能去图片服务器下载图片。也就无法显示图片了。

location ^~ /images/ {

if (!-e $request_filename){

rewrite ^/images/(.*)$  /images/imageserver/client.php?file=$1 last;

}

}

location ~ .*\.php$ {

fastcgi_pass    127.0.0.1:9000;

fastcgi_index   index.php;

fastcgi_param  SCRIPT_FILENAME /data/www/domain.com/public/$fastcgi_script_name;

include        fastcgi_params;

}

location ~* \.(gif|jpg|jpeg|png|bmp|swf)$ {

expires         120d;

}

location ~ .*\.(js|css)?$

{

expires 1h;

}

}

我应该怎么调整location,让client.php能被解析到。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值