Discuz论坛的搭建【基于LNMP环境搭建成功后】

##创建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 www.bbs.com bbs.com'>> /etc/hosts

##配置BBS和Nginx
在Nginx服务器下面配置bbs的Vhosts

vim /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 www.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

##下载&&安装BBS

wget  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,后进行修改

页面显示:

http://www.bbs.com/forum.php

检查安装环境

收回数据库权限:

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$ $/portal.php?mod=topic&topic=$ last;
rewrite ^([^\.]*)/article-([-]+)-([-]+)\.html$ $/portal.php?mod=view&aid=$&page=$ last;
rewrite ^([^\.]*)/forum-(\w+)-([-]+)\.html$ $/forum.php?mod=forumdisplay&fid=$&page=$ last;
rewrite ^([^\.]*)/thread-([-]+)-([-]+)-([-]+)\.html$ $/forum.php?mod=viewthread&tid=$&extra=page%3D$&page=$ last;
rewrite ^([^\.]*)/group-([-]+)-([-]+)\.html$ $/forum.php?mod=group&fid=$&page=$ last;
rewrite ^([^\.]*)/space-(username|uid)-(.+)\.html$ $/home.php?mod=space&$=$ last;
rewrite ^([^\.]*)/blog-([-]+)-([-]+)\.html$ $/home.php?mod=space&uid=$&do=blog&id=$ last;
rewrite ^([^\.]*)/(fid|tid)-([-]+)\.html$ $/archiver/index.php?action=$&value=$ last;
rewrite ^([^\.]*)/([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+)\.html$ $/plugin.php?id=$:$ last;
if (!-e $request_filename) {
return ;
}


3.测试并且重启服务

Linux 下Discuz论坛的搭建的更多相关文章

  1. LNMP架构下Discuz论坛的搭建

    在上一节中,我们对lnmp架构下的mysql.php.nginx进行源码的安装,并设置了相关的安装参数.现在我们将在上一节的基础上,把三者联系起来进行一个论坛的部署. 一.首先进行Discuz(社区论 ...

  2. Linux下Discuz!7.2 LAMP环境搭建

    linux下Discuz LAMP环境搭建 1.需要的源代码 httpd-2.2.15.tar.gz          mysql-5.1.44.tar.gz     php-5.3.2.tar.gz ...

  3. ​Linux下的SVN服务器搭建

    ​Linux下的SVN服务器搭建 鉴于在搭建时,参考网上很多资料,网上资料在有用的同时,也坑了很多人 本文的目的,也就是想让后继之人在搭建svn服务器时不再犯错,不再被网上漫天的坑爹作品所坑害,故此总 ...

  4. linux下利用elk+redis 搭建日志分析平台教程

    linux下利用elk+redis 搭建日志分析平台教程 http://www.alliedjeep.com/18084.htm   elk 日志分析+redis数据库可以创建一个不错的日志分析平台了 ...

  5. 记一次Linux下JavaWeb环境的搭建

    今天重装了腾讯云VPS的系统,那么几乎所有运行环境都要重新部署了.过程不难懂,但是也比较繁琐,这次就写下来,方便他人也方便自己日后参考参考. 我采用的是JDK+Tomcat的形式来进行JavaWeb初 ...

  6. Linux下的SVN服务器搭建(转)

    Linux下的SVN服务器搭建   鉴于在搭建时,参考网上很多资料,网上资料在有用的同时,也坑了很多人 本文的目的,也就是想让后继之人在搭建svn服务器时不再犯错,不再被网上漫天的坑爹作品所坑害,故此 ...

  7. Linux下使用 github+hexo 搭建个人博客07-next主题接入搜索和站点管理

    这是搭建个人博客系统系列文章的最后一篇,如果你是从第一篇一路跟下来的,那么恭喜你,即将完成整个博客网站的搭建.OK,话不多说,开始我们的收官之战. 不知你想过没有,如果我们的文章少,一眼看完整个目录, ...

  8. Linux下使用 github+hexo 搭建个人博客06-next主题接入数据统计

    之前说了 next 主题的优化和接入评论系统.让我们完成了自己所需的页面风格和排版,也可让访问用户在每篇博文评论,完成博主和访问用户的交互. 本章我们继续讲解其他重要功能. 既然是一个网站,那么我们就 ...

  9. Linux下使用 github+hexo 搭建个人博客05-next主题接入评论系统

    静态站点拥有一定的局限性,因此我们需要借助于第三方服务来扩展我们站点的功能. 而评论系统是最常用于和网站用户交流的,因此本章讲解在 next 主题,如何接入评论系统. 参考网站:Next 使用文档,第 ...

随机推荐

  1. 使用KindEditor完成图片上传(springmvc&fastdfs/springmvc&ftp)

    前端使用KindEditor,后台使用Springmvc 1 拷贝KindEditor相关文件到项目中 拷贝KindEditor相关文件到项目中 2 准备一个jsp页面 页面中我准备了一个超链接,点击 ...

  2. 使用postman模拟上传文件到springMVC的坑:the request was rejected because no multipart boundary was found

    参考该文解决问题:http://blog.csdn.net/sanjay_f/article/details/47407063 报错 threw exception [Request processi ...

  3. STL 排序(转载)

    这篇文章关于STL中的排序写的虽不深入,但是还是挺好的. 1.sort sort有两种形式,第一种形式有两个迭代器参数,构成一个前开后闭的区间,按照元素的 less 关系排序:第二种形式多加一个指定排 ...

  4. c之指针与数组(1)

    1.指针与地址 一元运算符&可用于取一个对象的地址.例如:int i=1;&i就是计算机地址. 一元运算符*是间接寻址或者间接引用运算符.例如: int x=1,y:int ip*: ...

  5. Ubuntu 10.10, 11.04, 11.10这三个版本无法从优盘启动

    问题:Ubuntu 10.10, 11.04, 11.10这三个版本无法从优盘启动 解决:从U盘启动安装的时候,会卡住不动.搞定办法相当简单,修改syslinux/syslinuxfg文件:将defa ...

  6. [转载]Vue 2.x 实战之后台管理系统开发(一)

    2. 开发前须知 我的后台管理系统项目运用了如下框架/插件: Vue 2.x —— 项目所使用的 js 框架,我所使用的版本是:2.1.10 vue-router 2 —— Vue 2.x 配套路由, ...

  7. C# 中的隐式类型转换(运算时的隐式转换)和显示类型转换

    区别: 隐式转换失败编译会报错. 显示转换有可能精度丢失. 根据项目的编译设置,显示转换溢出可能会报错,如果设置溢出且未使用checked检查,运行时如果发生溢出会产出未知的计算结果. 在数字运算时, ...

  8. Xss和Csrf介绍

    Xss和Csrf介绍 Xss Xss(跨站脚本攻击),全称Cross Site Scripting,恶意攻击者向web页面中植入恶意js代码,当用户浏览到该页时,植入的代码被执行,达到恶意攻击用户的目 ...

  9. C# 批量 json 读取

    // 方法一 //string test = "[{ 'CreateUser': 'CN=koujirou nishikawaOMHBK','CreateUserJ': '西川 公二郎'}, ...

  10. .net mvc 获取acion 返回类型

    1..net core 中获取 public override void OnActionExecuted(ActionExecutedContext context) { var descripto ...