nginx引入thinkphp5框架的相关配置

1.www.xxx.com.conf的server{}配置

server {
listen 80;
server_name www.xxx.com;
index index.html index.htm index.php;
root /home/wwwroot/www.xxx.com/public;

#error_page 404 /404.html;

include enable-php.conf;

location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {
expires 30d;
}

location ~ .*\.(js|css)?$ {
expires 12h;
}

location / {
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=$1 last;
break;
}
}

location ~ /\. {
deny all;
}
}

2.php.ini

#在php.ini行尾配置
[HOST=www.xxx.com]
open_basedir=/home/wwwroot/www.xxx.com/:/proc/:/tmp/
[PATH=/home/wwwroot/www.xxx.com/]
open_basedir=/home/wwwroot/www.xxx.com/:/proc/:/tmp/

posted on 2019-12-09 15:16  转身的猫  阅读(280)  评论(0编辑  收藏  举报

导航