網(wǎng)站配置文件:
server
{
listen 80;
server_name i.thinkcmf.com;
root /www/wwwroot/ThinkCMF/public;
#PHP-INFO-START PHP引用配置芝囤,可以注釋或修改
include enable-php-73.conf;
#REWRITE-START URL重寫規(guī)則引用,修改后將導(dǎo)致面板設(shè)置的偽靜態(tài)規(guī)則失效
include /www/server/panel/vhost/rewrite/i.thinkcmf.com.conf;
location / {
index index.php index.html index.htm;
#如果請求既不是一個文件牲芋,也不是一個目錄,則執(zhí)行一下重寫規(guī)則
if (!-e $request_filename)
{
#地址作為將參數(shù)rewrite到index.php上。
rewrite ^/(.*)$ /index.php?s=$1;
#若是子目錄則使用下面這句,將subdir改成目錄名稱即可家肯。
#rewrite ^/subdir/(.*)$ /subdir/index.php?s=$1;
}
}
location /api/ {
index index.php index.html index.htm;
#如果請求既不是一個文件菱属,也不是一個目錄,則執(zhí)行一下重寫規(guī)則
if (!-e $request_filename)
{
#若是子目錄則使用下面這句狂芋,將subdir改成目錄名稱即可。
rewrite ^/api/(.*)$ /api.php?s=$1;
}
}
location ~* ^\/upload\/.+\.(html|php)$ {
return 404;
}
location ~* ^\/plugins\/.+\.(html|php)$ {
return 404;
}
location ~* ^\/themes\/.+\.(html|php)$ {
return 404;
}
#proxy the php scripts to php-fpm
location ~ \.php {
include fastcgi_params;
##pathinfo支持start
#定義變量 $path_info 憨栽,用于存放pathinfo信息
set $path_info "";
#定義變量 $real_script_name帜矾,用于存放真實地址
set $real_script_name $fastcgi_script_name;
#如果地址與引號內(nèi)的正則表達(dá)式匹配
if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
#將文件地址賦值給變量 $real_script_name
set $real_script_name $1;
#將文件地址后的參數(shù)賦值給變量 $path_info
set $path_info $2;
}
#配置fastcgi的一些參數(shù)
fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
fastcgi_param SCRIPT_NAME $real_script_name;
fastcgi_param PATH_INFO $path_info;
###pathinfo支持end
fastcgi_intercept_errors on;
fastcgi_pass 127.0.0.1:9000;
# fastcgi_pass 如果是 sock形式,可能是下面的配置
# fastcgi_pass unix:/tmp/php-cgi.sock
}
access_log /dev/null;
error_log /www/wwwlogs/i.thinkcmf.com.error.log;
}