宜昌本地软件开发与弱电工程服务商
项目咨询 · 快速响应

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; }