您现在的位置是:首页 > cms教程 > Discuz教程Discuz教程
Linux环境怎么搭建Discuz论坛
肖任2025-06-26Discuz教程已有人查阅
导读在Nginx服务器下面配置bbs的Vhostsvim /usr/local/nginx/conf/nginx.conf -->添加includechown -R nginx.nginx bbs/ -->涉及用户提交头像等操作,简单起见,先改为nginx,后进行修改
##创建BBS数据库在本地/远程服务器mysql -uroot -proot
create database bbs;
show databases;
grant all on bbs.*to bbs@'localhost' identified by 'root';
grant all on bbs.*to bbs@'192.168.25.%' identified by 'root'; # 远程mysql服务器
flush privileges;
select user,host from mysql.user;
##远程连接数据库: mysql -ubbs -proot -h 192.168.25.138
echo ' 192.168.25.144.bbs.com bbs.com'>> /etc/hosts
##配置BBS和Nginx
在Nginx服务器下面配置bbs的Vhostsvim /usr/local/nginx/conf/nginx.conf -->添加include
vim /usr/local/nginx/conf/extra/bbs.conf -->配置域名
vim /etc/hosts -->添加DNS解析
/usr/local/nginx/sbin/nginx -t
/usr/local/nginx/sbin/nginx -s reload -->重启服务
mkdir -p /usr/local/nginx/html/bbs -->创建虚拟路径
cd /usr/local/nginx/html
chown -R root.root ./bbs
find ./blog/ -type f|xargs chmod 644
find ./blog/ -type d|xargs chmod 755 -->更改权限
server { listen 80; server_name.bbs.com; root html/discuz; location / {
# index index.html index.htm;
index index.php index.html index.htm;
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/archiver/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;} } location ~.*\.(php|php5)?$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi.conf; } access_log logs/access_discuz.log main; }
bbs.conf
##下载&&安装BBSwget http://ahdx.down.chinaz.com/201712/Discuz_X3.4_SC_UTF8_0101.zip -->q不显示
unzip Discuz_X3.4_SC_UTF8*.zip
rm Discuz_X3.4_SC_UTF8*.zip -rf
cd /usr/local/nginx/html/bbs
cp -rf upload/* ./ -->把文件直接放在bbs的根目录下,upload有安装脚本
chmod 644 /usr/local/nginx/html/bbs/*
chown -R nginx.nginx bbs/ -->涉及用户提交头像等操作,简单起见,先改为nginx,后进行修改页面显示:
检查安装环境
收回数据库权限:
drop user bbs@'192.168.25.%';
flush privileges;
grant update,insert,delete,drop,select on bbs.*to bbs@'192.168.25.%' identified by 'root';
删除安装程序,防止论坛再次安装rm -rf /usr/local/nginx/html/bbs/install用户上传的数据:--》将来挂在到NFS上
上传图片的路径:cd /usr/local/nginx/html/bbs/data/attachment/forum/201709/02
查看头像文件上传路径
cd /usr/local/nginx/html/bbs
find ./ type f -name '*.jpg' -mmin -13
./uc_server/data/avatar/000/00/00/01_avatar_small.jpg
#伪静态化
1.前台管理 ->全局 ->SOE设置 ->勾选URL静态化 ->提交
2.添加如下内容到/extra/bbs.conf 默认的location / 里 [可以查看discuz的规则添加即可]
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/archiver/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;}
3.测试并且重启服务
本文标签:
很赞哦! ()
相关教程
图文教程
discuz验证过程介绍
cdb_members表的secques字段是干嘛用的(二次操作验证之用)--意思是如果groupid='6', 那么ipbanned的值为真,为1清空了所有客户端cookie后的访问-
discuz nt 1.0分析
2.0一直也不推出,前几天看了几篇讨论dnt 1.0的文章,信心倍减。还是有一些地方看不太懂(没时间去懂?),今天看到一段AdminPage里的代码
Discuz百度jiathis代码分享
templates/default/viewthread_node.htm中找到$post[message],这个显示的是贴子内容,在这个div里你可以添加想显示的东西
腾讯云搭建Discuz个人论坛的方法
LAMP是Linux、Apache、MySQL和PHP的缩写,是Discuz论坛系统依赖的基础运行环境。我们先来准备LAMP环境安装MySQL使用yum安装MySQL:
相关源码
-
pbootcms模板(PC+WAP)微信小程序开发公司网站本模板为微信小程序开发代理、软件开发公司等企业设计,基于PbootCMS内核开发,支持PC+WAP双端响应式布局,数据实时同步,适用于多行业快速建站。查看源码 -
(自适应)英文电子芯片电子元件网站pbootcms模板下载基于PbootCMS内核开发的电子元件类企业专用模板,采用响应式设计技术,适配电子元器件、集成电路、半导体等行业的品牌展示与技术文档发布需求。前端布局针对芯片参数表格与产品规格书展示进行深度优化。查看源码 -
(自适应响应式)动力刀座五金机械设备pbootcms网站源码下载为动力刀座及五金机械企业定制的响应式网站框架,基于PbootCMS系统深度开发,助力传统制造企业实现数字化转型升级。采用手工编写的DIV+CSS前端架构,代码执行效率提升40%。查看源码 -
pbootcms模板(PC+WAP)传媒广告影视公司网站源码基于PbootCMS内核开发的全自适应传媒文化网站模板,为影视公司、广告传媒企业打造,同时支持多行业快速适配。通过替换文字图片即可转换为其他行业网站查看源码 -
帝国cms7.5奇闻异事末解之谜模板免费下载带数据本模板基于帝国CMS7.5系统开发,为神秘现象、未解之谜类主题网站设计。包含完整的PC端、移动端及百度MIP站同步生成功能,内置火车头采集规则模块,可快速采集目标站内容资源。整体设计风格神秘大气,符合主题定位。查看源码 -
html5响应式pbootcms模板新闻资讯博客网站源码该模板采用PbootCMS内核开发,专为新闻资讯类网站打造,同时具备高度行业适配性--只需替换图文内容即可快速转型为企业官网、行业门户等各类站点。查看源码
| 分享笔记 (共有 篇笔记) |