当前位置 : 主页 > 网络编程 > PHP >

nginx.conf

来源:互联网 收集:自由互联 发布时间:2021-06-28
nginx.conf //nginx配置虚拟主机server { listen 80; server_name fanpei.com; //域名 index index.html index.php; //默认首页为index.html root "E:/phpstudy/WWW/test"; //路径 autoindex on; //是否显示文件列表 location / { //隐
nginx.conf
//nginx配置虚拟主机


server { 
      listen 80; 
      server_name fanpei.com;        //域名
      index  index.html index.php;   //默认首页为index.html
      root "E:/phpstudy/WWW/test";  //路径
      autoindex  on;    //是否显示文件列表

      location / {   //隐藏入口文件
            if (!-e $request_filename){
              rewrite ^/(.*)$ /index.php/$1 last;
            }
        }
      
      location ~ \.php(.*)$  {                 //可以解析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;
        } 
    }
网友评论