nginx配置DocumentRoot

nginx配置DocumentRoot


            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;
        }

Nginx的$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;
        }

你可能感兴趣的:(nginx,document)