Nginx配置隐藏index.php和PATH_INFO支持

来源:互联网 发布:python idle官方下载 编辑:程序博客网 时间:2024/06/06 00:35
server {        listen       80;        server_name  myblog.com ;        root   "D:/phpStudy2/WWW/myblog/public";        location / {            index  index.html index.htm index.php;            #autoindex  on;             if (!-e $request_filename) {                rewrite ^/(.*)$ /index.php/$1;            }        }        location ~ \.php(.*)$ {            fastcgi_pass   127.0.0.1:9000;            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_params;        }}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24

==[注意]==

如果nignx/conf下有vhosts.conf这个文件的话,在这个文件里配置,当有这个文件的时候,在nginx.conf里配置是不起作用的。

原创粉丝点击