Linux 下Discuz论坛的搭建
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论坛的搭建的更多相关文章
- LNMP架构下Discuz论坛的搭建
在上一节中,我们对lnmp架构下的mysql.php.nginx进行源码的安装,并设置了相关的安装参数.现在我们将在上一节的基础上,把三者联系起来进行一个论坛的部署. 一.首先进行Discuz(社区论 ...
- 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 ...
- Linux下的SVN服务器搭建
Linux下的SVN服务器搭建 鉴于在搭建时,参考网上很多资料,网上资料在有用的同时,也坑了很多人 本文的目的,也就是想让后继之人在搭建svn服务器时不再犯错,不再被网上漫天的坑爹作品所坑害,故此总 ...
- linux下利用elk+redis 搭建日志分析平台教程
linux下利用elk+redis 搭建日志分析平台教程 http://www.alliedjeep.com/18084.htm elk 日志分析+redis数据库可以创建一个不错的日志分析平台了 ...
- 记一次Linux下JavaWeb环境的搭建
今天重装了腾讯云VPS的系统,那么几乎所有运行环境都要重新部署了.过程不难懂,但是也比较繁琐,这次就写下来,方便他人也方便自己日后参考参考. 我采用的是JDK+Tomcat的形式来进行JavaWeb初 ...
- Linux下的SVN服务器搭建(转)
Linux下的SVN服务器搭建 鉴于在搭建时,参考网上很多资料,网上资料在有用的同时,也坑了很多人 本文的目的,也就是想让后继之人在搭建svn服务器时不再犯错,不再被网上漫天的坑爹作品所坑害,故此 ...
- Linux下使用 github+hexo 搭建个人博客07-next主题接入搜索和站点管理
这是搭建个人博客系统系列文章的最后一篇,如果你是从第一篇一路跟下来的,那么恭喜你,即将完成整个博客网站的搭建.OK,话不多说,开始我们的收官之战. 不知你想过没有,如果我们的文章少,一眼看完整个目录, ...
- Linux下使用 github+hexo 搭建个人博客06-next主题接入数据统计
之前说了 next 主题的优化和接入评论系统.让我们完成了自己所需的页面风格和排版,也可让访问用户在每篇博文评论,完成博主和访问用户的交互. 本章我们继续讲解其他重要功能. 既然是一个网站,那么我们就 ...
- Linux下使用 github+hexo 搭建个人博客05-next主题接入评论系统
静态站点拥有一定的局限性,因此我们需要借助于第三方服务来扩展我们站点的功能. 而评论系统是最常用于和网站用户交流的,因此本章讲解在 next 主题,如何接入评论系统. 参考网站:Next 使用文档,第 ...
随机推荐
- TortoiseGit学习系列之Windows上TortoiseGit的安装详解(图文)
不多说,直接上干货! TortoiseGit的安装准备 首先你得安装windows下的msysgit. 安装版本控制器客户端TortoiseGit [不习惯英文的朋友,也可以下个语言包]. 下载地址: ...
- Check类之TypeValidation
(1)Validator类的visitTypeApply()方法 实例1: class TestTypeVal<T extends InputStream>{ TestTypeVal< ...
- 关于dubbo调度时出现Request processing failed; nested exception is com.alibaba.dubbo.rpc.RpcException: Failed to invoke the method insertTestTb in the service cn.cuibusi.core.service.TestTbService.的解决办法
在用dubbo跨项目调度service时出现如下错误: 错误原因:pojo没有实现序列化 解决方法:在pojo实现序列化接口即可
- Error处理:/bin/bash^M: 坏的解释器: 没有该文件或目录(bad interpreter: No such file or directory)
在Linux下编译运行脚本的时候出现”/bin/bash^M: 坏的解释器: 没有那个文件或目录(bad interpreter: No such file or directory)“这样的错误. ...
- C#判断字符串中是否包含一个子字符串是可以直接使用Contains()方法
1. 以前判断一个字符串中是否包含另一个子字符串时,习惯使用 IndexOf(); string str = "ABC@QQ"; if(str.IndexOf("@&qu ...
- Tomcat源码分析——请求原理分析(中)
前言 在<TOMCAT源码分析——请求原理分析(上)>一文中已经介绍了关于Tomcat7.0处理请求前作的初始化和准备工作,请读者在阅读本文前确保掌握<TOMCAT源码分析——请求原 ...
- Java泛型的逆变
在上篇<Java泛型的协变>这篇文章中遗留以下问题——协变不能解决将子类型添加到父类型的泛型列表中.本篇将用逆变来解决这个问题. 实验准备 我们首先增加以下方法,见代码清单1所示. 代码清 ...
- XmlDocument.LoadXml和Load的区别
LoadXml:从指定的字符串加载 XML 文档. eg:doc.LoadXml("<root>aa</root>"); .csharpcode, .csh ...
- nodejs文件上传组件multer使用
多图上传,发送端: var express = require('express') var rp = require('request-promise') var fs = require(&quo ...
- SpringMVC笔记:annotation注解式开发
一.配置式开发 在我们之前的学习中,springmvc使用配置式开发模式,需要在核心配置文件中springmvc.xml注册大量的bean来注入controller控制器,工作繁琐容易出错,下面我们学 ...