思途CMS nginx 偽靜態規則
為了讓(rang)Stourweb Cms 更好的在Nginx+fastcig環(huan)境下運行,思途(tu)(tu)官方做成如下示(shi)范文件,如下列所示(shi),其中思途(tu)(tu)配置是必須要引入(ru)的,基礎配置、首頁入(ru)口、
php運行模式需要(yao)您根(gen)據(ju)自己的服(fu)務器環(huan)境做出最優(you)的配(pei)置與優(you)化。
注,如果使用寶塔(ta),只需要在網站設置-》偽靜態-》添加標注綠色的(de)代碼
server {
#基礎配(pei)置
server_name cr2j.cn cr2j.cn;
listen 80 ;
index index.php;
root /www/web/stourweb;#你的(de)網站所在目錄
location / {
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=/$1 last;
break;
}
index index.html index.htm index.php;
#autoindex on;
}
#PHP 運行(xing)模式
location ~ ^(.+.php)(.*)$ {
fastcgi_split_path_info ^(.+.php)(.*)$;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
include fastcgi.conf;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
}
#這段是子站規則(ze),如網址(zhi)是,紅色部分(fen)替換為(wei)abc.com
if ($http_host ~ "^(.*)?.abc.com$"){
set $rule_0 1$rule_0;
set $bref_1 $1;
}
if ($bref_1 !~* ^www|m$){
rewrite ^/(lines|hotels|cars|spots|raiders|photos)(/)?$ //$bref_1.abc.com/$1/$bref_1 last;
}
#這(zhe)段是(shi)子站規則
#思途配(pei)置 stourweb_conf
#思途已將你(ni)所(suo)需要的nginx配(pei)置文(wen)件,統一整理到(dao)了網站根(gen)目(mu)錄下 stourweb_conf/nginx/中,除system.conf(系統標準配(pei)置)外,其他(ta)均為(wei)應用配(pei)置
#在線安裝完成以后,只需(xu)重新啟(qi)動(dong)nginx,不再(zai)做其他配置即可使用
#/www/web/stourweb為網站根目錄,需(xu)(xu)您根據自己的需(xu)(xu)要(yao)重新配(pei)置
include /www/web/stourweb/stourweb_conf/nginx/*.conf;
如果使用的非寶塔搭建的網站,可同樣在站點配置文件中引入nginx偽靜態配置文件,官方的配置文件路徑在 /站點目錄/stourweb_conf/nginx/*.conf
會員評論