本地是mac Apache开发环境,开启伪静态,都很正常,传到服务器后报500错误,可以在/usr/local/nginx/conf/fastcgi.conf 文件添加
fastcgi_param PHP_VALUE "open_basedir=/home/wwwroot/tp5/:/tmp/:/proc/";
执行service nginx restart命令重启nginx,发现网页报404错误,需要配置一下伪静态可以在/usr/local/nginx/conf/www.tp5.com.conf(根据实际情况而定)添加:location ~ .*\.(php|php5)?$
{
#fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
location / {
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=/$1 last;
break;
}
}
代码放在server{} 内最佳答案
