nginx配置中php相对路径问题
注:今天遇到了nginx+php的配置中使用相对路径的问题,搜到该博客,方法确实可行,转一下,原博客:nginx配置中php相对路径问题。
今天研究了一下windows下的nginx+mysql+php一键安装包,终于琢磨出来在nginx配置中php的相对路径设置的方法。
nginx.conf配置中设置网站相对路径和php相对路径方法不同,具体如下:
location / {
root ../www;
index index.html index.htm index.php;
}
location ~ .php$ {
root ./www;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
看root的设置,php相对路径用一个点,网站路径用两个点。