码迷,mamicode.com
首页 > 其他好文 > 详细

nginx配置

时间:2014-12-10 19:30:27      阅读:157      评论:0      收藏:0      [点我收藏+]

标签:style   blog   io   ar   color   sp   on   div   log   

1、nginx隐藏index.php

  下面是虚拟主机隐藏index.php的一个案例,其中红色的就是隐藏index.php

server {
        listen       80;
        server_name  www.sand.com alias sand.com;
        location / {
            root   D:/sandbox_pro/sandbox;
            if ( -f  $request_filename/index.php) {
                rewrite (.*) $1/index.php;
        }

        if ( !-f $request_filename )  {
                rewrite (.*) /index.php;
        }
            index  index.html index.htm default.html default.htm index.php default.php app.php u.php;
            include        D:/sandbox_pro/sandbox/up-*.conf;
        }
        autoindex off;
        include advanced_settings.conf;
        location ~ ^.+\.php {
            root          D:/sandbox_pro/sandbox;
            fastcgi_pass   bakend;
            fastcgi_index  index.php;
            fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            fastcgi_param  PATH_INFO $fastcgi_path_info;
            fastcgi_param  PATH_TRANSLATED $document_root$fastcgi_path_info;
            include        fastcgi.conf;
        }
        }
#server www.sand.com end}

 

nginx配置

标签:style   blog   io   ar   color   sp   on   div   log   

原文地址:http://www.cnblogs.com/webclz/p/4155964.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!