您当前的位置: > 个人博客 > php分类

nginx下,隐藏index.php,并且解决二级目录的问题

2016-10-13 00:16:48 点击量:215 标签: 收藏本文

nginx下,隐藏index.php,并且解决二级目录的问题
首先是nginx.conf
    server {         fastcgi_intercept_errors on;         listen       80;         server_name  localhost;         charset utf-8;                  root   E:/php;         index  index.php index.html index.htm;         location / {             autoindex  on;             try_files $uri $uri/ @rewrite;         }                  location @rewrite {             rewrite (/[a-z0-9]+/)(.+) $1index.php/$2;         }                  location ~* /protected/.* {             deny  all;         }         location ~ /\.ht {             deny  all;         }                  include alias/*.conf;                  location ~* \.php/?.*$ {             fastcgi_pass   127.0.0.1:9000;             fastcgi_index  index.php;             fastcgi_param  SCRIPT_FILENAME  E:/php$fastcgi_script_name;             include        fastcgi_params;         }     }

然后是虚拟目录的配置,我这里暂时只要用到phpmyadmin,所以只有这个
location ~* /phpmyadmin.* {     alias G:/server/bin/phpmyadmin;     index index.php;     fastcgi_pass   127.0.0.1:9000;     fastcgi_index  index.php;     fastcgi_param  SCRIPT_FILENAME  G:/server/bin$fastcgi_script_name;     include        fastcgi_params; }

ABOUT US
宜昌农人网络科技有限公司

我们是一家提供综合软件外包与弱电工程服务的技术公司。

业务涵盖定制软件、管理系统、网站、小程序、APP、系统集成、网络布线、监控安防、门禁、机房建设及长期技术维护。

公司地址:湖北省宜昌市伍家岗区东站二路6号三峡(宜昌)大数据产业园海洋馆二楼A203室