ITPub博客

首页 > Linux操作系统 > Linux操作系统 > nginx新手配置$document_root

nginx新手配置$document_root

Linux操作系统 作者:IT王大王 时间:2015-01-23 15:46:58 0 删除 编辑

nginx新手配置$document_root

nginx配置php老是出错,最后才发现是$document_root的设置问题。

            location ~ \.php$ {

            root           html;

            fastcgi_pass   127.0.0.1:9000;

            fastcgi_index  index.php;

            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

            include        fastcgi_params;

        }

这个用出现找不到php的错误。因为$document_root 的参数是由root html那一行定义的,默认是在/etc/nginx/html/ 所以把 html换成站点根目录就正常了。

            location ~ \.php$ {

            root           /usr/share/nginx/html;

            fastcgi_pass   127.0.0.1:9000;

            fastcgi_index  index.php;

            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

            include        fastcgi_params;

        }

 

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/30094666/viewspace-1412272/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: tomcat linux命令
请登录后发表评论 登录
全部评论

注册时间:2015-01-06

  • 博文量
    58
  • 访问量
    67133