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. python-cgi-demo

    简单的Python CGI 在linux平台实现注意:路径是以当前路径为根目录 ,Python文件一般放在/cgi-bin/目录下在linux命令行运行:python  -m  CGIHTTPServ ...

  2. OpenJDK编译运行

    获取OpenJDK源码有两种方式,其中一种是通过Mercurial代码版本管理工具从Repository中直接取得源码(Repository地址:http://hg.openjdk.java.net/ ...

  3. finally是否始终执行

    The only times finally won't be called are: If you call System.exit() If the JVM crashes first If th ...

  4. c++类型形参的实参的受限转换

    缘起:<c++ primer> 4th, 528页,习题16.3 源程序 #include <iostream> #include <vector> #includ ...

  5. Mac下PHP+Apache+MySQL环境搭建

    一.启动Apache 有两种方法 1.打开网络共享 打开"系统偏好设置"->"共享",在"互联网共享"那一项前面打√. 2.打开终端, ...

  6. CF898A Rounding

    题意翻译 给你一个数字,将其“四舍六入”,末尾为5舍去或进位都可,求最终的数字. 题目描述 Vasya has a non-negative integer n n n . He wants to r ...

  7. 第二章.JSP/Servlet及相关技术详解

    JSP的4种基本语法: 1.JSP注释: <%-- JSP注释部分 --%> 2.JSP声明: <%! //声明一个整型变量 public int count; //声明一个方法 p ...

  8. 错误:Attempted to load applicationConfig: [classpath:/application.yml] but snakeyaml was not found on the classpath

    MyEclipse导入工程,报错如下: ::42.187 [main] ERROR org.springframework.boot.SpringApplication - Application r ...

  9. Freebsd10.3(FreeBSD11 Beta1)使用手记

    Freebsd10.3(FreeBSD11 Beta1)使用手记 1.安装系统. 2.设置ssh2登录,并开启ftp. (1)编辑/etc/ssh/sshd_config文件,设置如下: Permit ...

  10. BZOJ2987:Earthquake(类欧几里德算法)

    Sol 设 \(n=\lfloor\frac{c}{a}\rfloor\) 问题转化为求 \[\sum_{i=0}^{n}\lfloor\frac{c-ax}{b}\rfloor+1=\sum_{i= ...