zoukankan      html  css  js  c++  java
  • Nginx 开启 path_info功能

    server {
            listen       80;
            server_name  localhost;
            
            #charset koi8-r;
    
            #access_log  logs/host.access.log  main;
            root   "E:/phpStudy/WWW";
            
            location / {
                index  index.html index.htm index.php l.php;
                autoindex  off;
                #如果请求既不是一个文件,也不是一个目录,则执行一下重写规则
                if (!-e $request_filename)
                {
                  #地址作为将参数rewrite到index.php上。
                  rewrite ^/(.*)$ /index.php/$1;
                  #若是子目录则使用下面这句,将subdir改成目录名称即可。
                  #rewrite ^/subdir/(.*)$ /subdir/index.php/$1;
                }
                
            }
    
            #error_page  404              /404.html;
    
            # redirect server error pages to the static page /50x.html
            #
            error_page   500 502 503 504  /50x.html;
            location = /50x.html {
                root   html;
            }
    
            # proxy the PHP scripts to Apache listening on 127.0.0.1:80
            #
            #location ~ .php$ {
            #    proxy_pass   http://127.0.0.1;
            #}
    
            # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
            #
            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;
            }
            
            
    
            # deny access to .htaccess files, if Apache's document root
            # concurs with nginx's one
            #
            #location ~ /.ht {
            #    deny  all;
            #}
        }

    编辑Nginx配置文件 一般在 /etc/nginx/conf.d 目录下 红色部分按如上配置

  • 相关阅读:
    MyEclipse 工具优化和初始化设置
    ubuntu添加软件源
    C/C++数组名与指针区别深入探索
    为什么不常见include .c文件
    [置顶] Linux学习笔记(完整版)
    linux .deb文件安装
    我们就是查拉图斯特拉所说最后的人?!
    关于Mina
    讨厌SVN
    关于对Mina的一些看法
  • 原文地址:https://www.cnblogs.com/gosky/p/5186503.html
Copyright © 2011-2022 走看看