修改完记得执行:service nginx restart (重启nginx)
方法一
在项目的conf中添加下发代码
location / {
root /usr/local/nginx/html;
index index.html index.htm index.php;
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php?s=$1 last;
}
}
方法二
步骤一
在/usr/local/nginx/conf/fastcgi.conf配置文件:
fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/:/tmp/:/proc/";
之后添加:
fastcgi_param PHP_ADMIN_VALUE $basedir if_not_empty;
步骤二
/usr/local/nginx/conf/vhost/xxxxx.com.conf 配置文件
root后面添加:
set $basedir "open_basedir=/home/wwwroot/xxxxx.com.cn/:/tmp/:/proc/";
修改
root /home/wwwroot/xxxxx.com
为
root /home/wwwroot/xxxxx.com/public;
在后面添加
location / {
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=/$1 last;
}
}
方法三
/usr/local/nginx/conf/vhost/xxxxx.com.conf 配置文件
将 include enable-php.conf;
修改为:
include enable-php-pathinfo.conf;