LNMP下添加Discuz x2.5的偽靜態(tài)規(guī)則
更新時間:2016年09月20日 22:09:44 投稿:mdxy-dxy
今天一個找我配置過 lnmp 環(huán)境的用戶要搭建 Discuz 論壇,但是發(fā)現(xiàn)不支持偽靜態(tài),倡萌沒怎么折騰過 Discuz,百度下才知道,原來軍哥的 LNMP 環(huán)境包自帶的 DZ 規(guī)則不適用于 Discuz x2.5,記錄下對應(yīng)的偽靜態(tài)規(guī)則
打開 LNMP 偽靜態(tài)文件目錄:
復制代碼 代碼如下:
cd /usr/local/nginx/conf
新建并編輯 discuzx25.conf 文件:
復制代碼 代碼如下:
vi discuzx25.conf
按 i 進入編輯模式,添加下面的代碼:
復制代碼 代碼如下:
rewrite ^([^\.]*)/topic-(.+)\.html$ $1/portal.php?mod=topic&topic=$2 last;
rewrite ^([^\.]*)/article-([0-9]+)-([0-9]+)\.html$ $1/portal.php?mod=view&aid=$2&page=$3 last;
rewrite ^([^\.]*)/forum-(\w+)-([0-9]+)\.html$ $1/forum.php?mod=forumdisplay&fid=$2&page=$3 last;
rewrite ^([^\.]*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=viewthread&tid=$2&extra=page%3D$4&page=$3 last;
rewrite ^([^\.]*)/group-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=group&fid=$2&page=$3 last;
rewrite ^([^\.]*)/space-(username|uid)-(.+)\.html$ $1/home.php?mod=space&$2=$3 last;
rewrite ^([^\.]*)/blog-([0-9]+)-([0-9]+)\.html$ $1/home.php?mod=space&uid=$2&do=blog&id=$3 last;
rewrite ^([^\.]*)/(fid|tid)-([0-9]+)\.html$ $1/index.php?action=$2&value=$3 last;
rewrite ^([^\.]*)/([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+)\.html$ $1/plugin.php?id=$2:$3 last;
if (!-e $request_filename) {
return 404;
}
按 Esc 退出編輯模式,輸入 :wq 保存退出。
然后進入網(wǎng)站配置文件目錄:
復制代碼 代碼如下:
cd /usr/local/nginx/conf/vhost
編輯對應(yīng)的網(wǎng)站配置文件,比如 aaa.com.conf
復制代碼 代碼如下:
vi aaa.com.conf
找到配置中的
復制代碼 代碼如下:
include discuz.conf;
修改為
復制代碼 代碼如下:
include discuzx25.conf;
保存后,重啟 Nginx或LNMP:
復制代碼 代碼如下:
lnmp restart
注:以上是 lnmp 1.2 下的操作。
相關(guān)文章
centos7系統(tǒng)下python2與python3共存
這篇文章主要給大家介紹了關(guān)于在centos7系統(tǒng)下python2與python3共存的相關(guān)資料,文中通過示例代碼介紹的非常詳細,對大家學習或者使用centos7爬蟲具有一定的參考學習價值,需要的朋友們下面來一起學習學習吧2019-08-08
Linux系統(tǒng)下virtuoso數(shù)據(jù)庫安裝與使用詳解
這篇文章主要介紹了Linux系統(tǒng)下virtuoso數(shù)據(jù)庫安裝與使用 ,本文給大家介紹的非常詳細,具有一定的參考借鑒價值,需要的朋友可以參考下2018-11-11
CentOS7 修改網(wǎng)卡名稱為eth0&在VMWare中添加多網(wǎng)卡配置
這篇文章主要介紹了CentOS7 修改網(wǎng)卡名稱為eth0&在VMWare中添加多網(wǎng)卡配置,具有一定的參考價值,感興趣的小伙伴們可以參考一下。2017-03-03

