免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1893 | 回复: 3
打印 上一主题 下一主题

nginx的location设置 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-08-25 17:05 |只看该作者 |倒序浏览
想请教一下关于nginx的location配置问题:
我有这样一个配置文件
server {
        listen   80;
        server_name  www.gonline.com;
        access_log  /var/log/nginx/localhost.access.log ;
        location / {
                root   /opt/www_data/code/public_html;
                index  index.php index.html index.htm;
if (!-e $request_filename){
rewrite ^/(.*)$ /index.php/$1 last;
}
        location ~ \.php$ {
                root /opt/www_data/code/public_html;
                fastcgi_pass   127.0.0.1:9000;
                fastcgi_index  index.php;
                fastcgi_param  SCRIPT_FILENAME  /opt/www_data/code/public_html$fastcgi_script_name;
                #fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
                include /etc/nginx/fastcgi_params;
        }
        location  /index.php {
                root /opt/www_data/code/public_html;
                fastcgi_pass   127.0.0.1:9000;
                fastcgi_index  index.php;
                fastcgi_param  SCRIPT_FILENAME  /opt/www_data/code/public_html$fastcgi_script_name;
                #fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
                include /etc/nginx/fastcgi_params;
        }
        location ^~ /members {
                root /opt/www_data/code/public_html/src/members;
                fastcgi_pass   127.0.0.1:9000;
                fastcgi_index  index.php;
if ($request_filename ~* ^/gaia/members/){
rewrite ^/gaia/members/(.*)$ /index.php break;
}
        #        fastcgi_param  SCRIPT_FILENAME  /opt/www_data/code/public_html/gaia/members;
                fastcgi_param  SCRIPT_FILENAME  /opt/www_data/code/public_html$fastcgi_script_name;
                #fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
                include /etc/nginx/fastcgi_params;
        }
问题1:nginx的访问顺序是什么?
问题2:第三段location中的members是个php脚本,后面会有参数,在网站应用中始终没有访问成功,不知道这个应该怎么配置,能够实现这一的功能,如:http://localhost/src/members/aaaaaaaaaaa.jpg,members中包含访问网络的路径,得到图片,使用apache的时候是可以的,换nginx就不行了~~

论坛徽章:
0
2 [报告]
发表于 2009-08-26 17:13 |只看该作者
这么冷嘛?没人回~

论坛徽章:
0
3 [报告]
发表于 2009-08-27 18:18 |只看该作者
原帖由 luanqibazao 于 2009-8-26 17:13 发表
这么冷嘛?没人回~

为何不直接作扩展名的匹配

论坛徽章:
0
4 [报告]
发表于 2009-08-27 22:57 |只看该作者

回复 #1 luanqibazao 的帖子

直接扩展名匹配正则表达式
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP