thinkphp icon indicating copy to clipboard operation
thinkphp copied to clipboard

Tp5在nginx下如何配置conf文件应对opendir

Open lovearthhome opened this issue 8 years ago • 0 comments

刚刚建立的tp网站,打开首页是这个样子 image

查询了一番,说是opendir错误。参考https://www.kancloud.cn/manual/thinkphp5/336757后修改nginx配置文件如下,就增加了fastcgi_param PHP_VALUE这一行。 然而,打开网站还是上面的样子。 大牛大神帮我看一下,这里面哪里设置错了。 ` server { listen 80; server_name admin.mydomain.com; #index index.html index.htm index.php default.html default.htm default.php; root /var/www/html/admin.mydomain.com/public; location / { index index.htm index.html index.php; if ( -f $request_filename) { break; } #访问路径的文件不存在则重写URL转交给ThinkPHP处理 if (!-e $request_filename) { rewrite ^(.*)$ /index.php?s=$1 last; } } location ~ [^/].php(/|$) { set $path_info ""; #定义变量 $real_script_name,用于存放真实地址 set $real_script_name $fastcgi_script_name; #如果地址与引号内的正则表达式匹配 if ($fastcgi_script_name ~ "^(.+?.php)(/.+)$") { #将文件地址赋值给变量 $real_script_name set $real_script_name $1; #将文件地址后的参数赋值给变量 $path_info set $path_info $2; } #配置fastcgi的一些参数 fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; #include fastcgi.conf;
fastcgi_param SCRIPT_FILENAME $document_root$real_script_name; fastcgi_param SCRIPT_NAME $real_script_name; fastcgi_param PATH_INFO $path_info;

		fastcgi_param PHP_VALUE "open_basedir=/var/www/html/admin.**mydomain**.com/:/tmp/:/proc/";
		include  fastcgi_params;
	}

}

`

lovearthhome avatar Oct 15 '17 04:10 lovearthhome