1.需要修改.user.ini 站点目录后加/
chattr -i .user.ini #去掉文件无法修改属性
修改内容为如下:
open_basedir=/mnt/wwwroot/hunter.com/:/tmp/:/proc/ #默认目录后没有"/"
2.使用LNMP1.4上需要将 /usr/localinx/conf/fastcgi.conf 里面的fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/:/tmp/:/proc/"; 在该行行前添加 # 或直接删除。
3.修改站点伪静态,添加到日志access_log段前即可
location / {
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php?s=$1 last;
}
}
整个配置文件:
server
{
listen 80;
#listen [::]:80;
server_name 域名;
index index.html index.htm index.php default.html default.htm default.php;
root 站点目录;
include other.conf;
#error_page 404 /404.html;
include enable-php-pathinfo.conf;
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
location ~ /\.
{
deny all;
}
location / {
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php?s=$1 last;
}
}
access_log /home/wwwlogs/域名.log;
}
4.重启整个lnmp服务框架
lnmp restart