我的nginx配置文件怎么和老师的不一样?

来源:6-1 LAMP之安装nginx

侠客岛的含笑

2016-10-13 14:45

   #PHP 脚本请求全部转发到 FastCGI处理. 使用FastCGI默认配置.
    location ~ \.php$ {
        root /root;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME /home/www/www$fastcgi_script_name;
        include fastcgi_params;

写回答 关注

1回答

  • Lane
    2016-10-14 10:49:59
    已采纳
    server
    {
        listen       80;
        server_name  localhost;
        index index.html index.htm index.php;
        root /var/www/html;
        location ~ [^/]\.php(/|$)
        {
             fastcgi_pass 127.0.0.1:9000;
             fastcgi_index  index.php;
             fastcgi_split_path_info ^(.+?\.php)(/.*)$;     #增加这一句
             fastcgi_param PATH_INFO $fastcgi_path_info;    #增加这一句
             fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
             include        fastcgi_params;
        }
    }


    侠客岛的含笑

    非常感谢!

    2016-10-14 14:35:36

    共 1 条回复 >

PHP环境LAMP/LNMP安装与配置

本课程适于PHP初学者,手把手教你LAMP/LNMP环境安装配置

45275 学习 · 224 问题

查看课程

相似问题