您现在的位置是:首页 > cms教程 > Discuz教程Discuz教程
wordpress、Discuz产品部署示例
怜菡2025-07-21Discuz教程已有人查阅
导读Wordpress、Discuz产品部署三个产品提供挂载的目录信息创建一个博客,用wordpress数据库的设置把nginx和php加入开机自启动:首先,在数据库创建一个wordpress的数据库
Wordpress、Discuz产品部署
三个产品提供挂载的目录信息
数据库的设置
把nginx和php加入开机自启动:
上传wordpress的包或者用下载到/application/nginx/html/blog
vim /application/nginx/html/blog/wp-config.php
内容填写完连接信息后,下一步,会生成连接文件,可在页面复制。
或者修改blog/wp-config-sample.php 并保存为blog/wp-config.php
1、在LNMP主机里在做解析(有几台Web就做几台解析)
添加伪静态:
在设置-->固定链接-->自定义结构(选定)/archiver/%post_id%.html
然后添加伪静态文件
Wordpress产品的挂载目录为:
再挂载:
NFS提供的挂载数据如下:
创建BBS论坛:
在数据库里创建相应的数据库和授权连接的IP段:
数据库:
说明:192.168.162.% 此处是远程的IP段,如果是本机则改成 localhost
WEB端:
测试远程连接数据库:
来自 192.168.162.135 的回复: 字节=32 时间<1ms TTL=64
再查看一下服务器的IP和windows解析是不是一样。
浏览器安装Discuz
注:所需状态必须全绿
更改数据库权限:
管理用权限,因为上面对数据库授权太大,所以这里要更改一下数据库的用户权限。
头像目录:/bbs/uc_server/data/avatar
图片目录:bbs/data/attachment/forum
为了防止别人来重新安装,也可以把删除:
在页面选择“模块管理”进入
输入验证密码。
选择论坛
先删除默认的模块:(先删除默认版块)
添加新的分区
添加新的版块
配置伪静态
查看rewrite规则(点击进入,下翻找开Nginx Web Server)
在服务器配置伪静态
检查语法:
三个产品提供挂载的目录信息
BLOG
/data/ /blog/wp-content/uploads/ 图片和附件
BBS:
/data/ /bbs/data/attachment/image
/data/ /bbs/uc_server/data/avatar 图像目录
/data/ /bbs/data/attachment/forum/ 图片路径
WWW:
/data/ / /images/swfupload
/data/ / /uploads/allimg/
创建一个博客,用wordpress数据库的设置
把nginx和php加入开机自启动:
[root@lnmp-1 extra]# vim /etc/rc.local
/application/nginx/sbin/nginx
/application/php/sbin/php-fpm
首先,在数据库创建一个wordpress的数据库
mysql> create database wordpress; 创建wordpress 的数据库
mysql> show databases; 查看所有的数据库
创建用户wordpress 并指定wordpress在192.168.162.135上登录,给出密码
mysql> grant all on wordpress.* to wordpress@'182.61.51.96' identified by '111111';
mysql> flush privileges;
查看wordpress的数据库
mysql> select user,host from mysql.user where user='wordpress';
查看所有的数据库
mysql> select user,host from mysql.user;
mysql> use wordpress 切换到wordpress
mysql> show tables; 查看wordpress下的所有表
mysql> select * from ol_users; 查看ol_users 的所有信息。
说明:如果创建博客站点时报错,就注意下面all那里,不要做限制。
mysql> grant all on wordpress.* to wordpress@'192.168.162.%' identified by '111111';
mysql> flush privileges;
完成后,再执行下面的命令。
mysql> grant select,insert,update,delete on wordpress.* to wordpress@'192.168.162.%' identified by '111111';
mysql> flush privileges;
安装wordpress 的博客程序上传wordpress的包或者用下载到/application/nginx/html/blog
cd /application/nginx/html/blog
rz -y wordpress-4.2.2-zh_CN.tar.gz 上传这个包
[root@lnmp-1 blog]# tar xf wordpress-4.2.2-zh_CN.tar.gz
[root@lnmp-1 blog]# mv wordpress/* . 把wordpress里的所有文件移到当前目录
[root@lnmp-1 blog]# rm -fr wordpress/
权限管理,把所有文件设置为644,目录设置为755
[root@lnmp-1 html]# find ./blog/ -type f|xargs chmod 644
[root@lnmp-1 html]# find ./blog/ -type d|xargs chmod 755
把上传文件设置为nginx的用户和组。
[root@lnmp-1 html]# chown -R nginx.nginx blog/wp-content/uploads/
修改index.php 加入blog.conf配置文件
[root@lnmp-1 application]# cd /application/nginx/conf/extra/
[root@lnmp-1 extra]# vim blog.conf
server {
listen 80;
server_name blog.etiantian.org;
root html/blog;
location / {
root html/blog;
index index.php index.html index.htm; 把index.php的主页面加入
}
location ~.*\.(php|php5)?$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
}
配置一个连接数据库的文件:vim /application/nginx/html/blog/wp-config.php
内容填写完连接信息后,下一步,会生成连接文件,可在页面复制。
或者修改blog/wp-config-sample.php 并保存为blog/wp-config.php
##注:创建数据库的信息一定要和这里一样,不然连接不上
// ** MySQL 设置 - 具体信息来自您正在使用的主机 ** //
/** WordPress数据库的名称 */
define('DB_NAME', 'wordpress');
/** MySQL数据库用户名 */
define('DB_USER', 'wordpress');
/** MySQL数据库密码 */
define('DB_PASSWORD', '111111');
/** MySQL主机 */
define('DB_HOST', '192.168.162.131');
* 不同的数据表前缀。前缀名只能为数字、字母加下划线。
*/
$table_prefix = 'od_';
把IP做解析:1、在LNMP主机里在做解析(有几台Web就做几台解析)
[root@lnmp-1 blog]# vim /etc/hosts
192.168.162.135.ebingou.cn ebingou.cn bbs.ebingou.cn blog.ebingou.cn
192.168.162.131 db.mysql.sql
2、在Windows里做解析(有几台Web就做几台解析)
C:\Windows\System32\drivers\etc\hosts
192.168.162.135.ebingou.cn bbs.ebingou.cn blog.ebingou.cn ebingou.cn
192.168.162.136.ebingou.cn bbs.ebingou.cn blog.ebingou.cn ebingou.cn
3、连接数据库也可以做解析(优化)
192.168.162.131 db.mysql.sql
可以/application/nginx添加伪静态:
在设置-->固定链接-->自定义结构(选定)/archiver/%post_id%.html
然后添加伪静态文件
[root@lnmp-1 extra]# pwd
/application/nginx/conf/extra
[root@lnmp-1 extra]# vim blog.conf
server {
listen 80;
server_name blog.etiantian.org;
root html/blog;
location / {
index index.php index.html index.htm;
if (-f $request_filename/index.html){
rewrite (.*) $1/index.html break;
}
if (-f $request_filename/index.php){
rewrite (.*) $1/index.php;
}
if (!-f $request_filename){
rewrite (.*) /index.php;
}
}
location ~.*\.(php|php5)?$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
}
再检查语法和启动
[root@lnmp-1 nginx]# ./sbin/nginx -t
[root@lnmp-1 nginx]# ./sbin/nginx -s reload
关于远程管理挂载的文件目录:Wordpress产品的挂载目录为:
/application/nginx/html/blog/wp-content/uploads/
挂载:
bin/mount -t nfs -o noatime,nodiratime,nosuid,noexec,nodev, 192.168.162.130:/backup/blog/www/application/nginx/html/blog/wp-content/uploads/
说明:如果博客里面有了文件,则需要在挂载之前转移备份里面的文件:
[root@lnmp-1 uploads]# mv 2015/www/opt/
[root@lnmp-1 uploads]# rm -fr 2015/
注:此处用mv来转移文件,cp -a 会导致权限自动修改,恢复也用mv再挂载:
/bin/mount -t nfs -o noatime,nodiratime,nosuid,noexec,nodev, 192.168.162.130:/backup/blog/www/application/nginx/html/blog/wp-content/uploads/
注:此处挂载,要注意NFS提供的权限要提供匿名用户运行(all_squash),要不然会导致无法上传文件。NFS提供的挂载数据如下:
[root@nfs ~]# cat /etc/exports
#shared data for bbs by mobboy
/backup/blog 192.168.162.0/24(rw,sync,all_squash)
/backup/bbs 192.168.162.0/24(rw,sync,all_squash)
/backup/192.168.162.0/24(rw,sync,all_squash)
挂载目录的权限:
chown -R nfsnobody.nfsnobody /backup/*
恢复原有的数据:
[root@lnmp-1 uploads]# mv /opt/2015/ ./
OK!! 博客完成创建BBS论坛:
在数据库里创建相应的数据库和授权连接的IP段:
数据库:
mysql> show databases;
mysql> create database bbs;
mysql> show databases;
mysql> grant select,insert,delete,update,create,drop on bbs.* to bbs@'192.168.162.%' identified by '111111';
mysql> flush privileges;
mysql> select user,host from mysql.user;
注:上面黄颜色的授权仅用于安装,或者用all替代,工作中用不create。说明:192.168.162.% 此处是远程的IP段,如果是本机则改成 localhost
WEB端:
测试远程连接数据库:
[root@lnmp-1 ~]# mysql -ubbs -p111111 -h 192.168.162.131
cd /application/nginx/conf/extra/
vim bbs.conf
[root@lnmp-1 extra]# vim bbs.conf
access_log logs/access_bbs.log main;
server {
listen 80;
server_name bbs.etiantian.org;
root html/bbs;
location / {
index index.php index.html index.htm;
}
location ~.*\.(php|php5)?$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
}
../../sbin/nginx -t
../../sbin/nginx -s reload
在此可写一个phpinfo.php测试连接
[root@lnmp-1 blog]# vim phpinfo.php
<?php
phpinfo();
?>
安装BBS Discuz产品:
cd ../../html/bbs/
wget http://download.comsenz.com/DiscuzX/3.2/Discuz_X3.2_SC_UTF8.zip
unzip -o Discuz_X3.2_SC_UTF8.zip
[root@lnmp-1 bbs]# ll
-rw-r--r-- 1 root root 12493463 6月 9 10:58 Discuz_X3.2_SC_UTF8.zip
-rw-r--r-- 1 root root 18 10月 5 02:18 index.html
drwxr-xr-x 2 root root 4096 6月 9 10:21 readme
drwxr-xr-x 12 root root 4096 6月 9 10:21 upload
drwxr-xr-x 4 root root 4096 6月 9 10:21 utility
[root@lnmp-1 bbs]# rm -fr readme/ utility/ index.html Discuz_X3.2_SC_UTF8.zip
[root@lnmp-1 bbs]# mv upload/* .
授权
[root@lnmp-1 bbs]# chown -R nginx.nginx config/ data/ uc_*
在windows解析
C:\Users\Administrator>ping bbs.etiantian.org
正在 Ping.etiantian.org [192.168.162.135] 具有 32 字节的数据:来自 192.168.162.135 的回复: 字节=32 时间<1ms TTL=64
再查看一下服务器的IP和windows解析是不是一样。
浏览器安装Discuz
注:所需状态必须全绿
更改数据库权限:
管理用权限,因为上面对数据库授权太大,所以这里要更改一下数据库的用户权限。
mysql>drop user bbs@’192.168.162.%’
mysql> select user,host from mysql.user;
mysql> grant select,insert,delete,update,drop on bbs.* to bbs@'192.168.162.%' identified by '111111';
mysql> flush privileges;
mysql> select user,host from mysql.user;
BBS 上传的路径:头像目录:/bbs/uc_server/data/avatar
图片目录:bbs/data/attachment/forum
为了防止别人来重新安装,也可以把删除:
[root@lnmp-1 bbs]# rm -fr install/
下面来添加一个模块,测试一下:在页面选择“模块管理”进入
输入验证密码。
选择论坛
先删除默认的模块:(先删除默认版块)
添加新的分区
添加新的版块
配置伪静态
查看rewrite规则(点击进入,下翻找开Nginx Web Server)
在服务器配置伪静态
[root@lnmp-1 conf]# vim extar/bbs.conf
server {
listen 80;
server_name bbs.ebingou.cn;
root html/bbs;
location / {
index index.php index.html index.htm;
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;
}
}
location ~.*\.(php|php5)?$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
}
重新启动检查语法:
[root@lnmp-1 conf]# /application/nginx/sbin/nginx -t
优雅启动:
/application/nginx/sbin/nginx -s reload
本文标签:
很赞哦! ()
相关教程
图文教程
Discuz的NT中URL地址重写URLRewrite介绍
在Discuz!NT中的前台页面访问(特别是aspx)是被HttpModule接管的,所以大家在Discuz.Web项目的目录下看到的唯一"aspx文件"是index.aspx,而所有其它前台页面都有“/aspx/”
安装Discuz论坛时提示“mysqli_connect()不支持advice_mysqli
安装Discuz!论坛时提示“不支持Mysql数据库,无法安装论坛”的解决方法1,在系统的 system32(C:\windows\system32)目录下缺少libmysql.dll文件,解决方法是找到php目录下的libmysql.dll
discuz的template模板文件说明
公共模板文件夹./template/default/common/common.css 公共CSS文件faq.htm 帮助模板文件footer.htm 系统总底部模板footer_ajax.htm ajax模式是使用到的系统总底部模板
Discuz集成第三方统计工具如百度统计的方法
将Discuz与百度统计集成,意味着在你的论坛页面中嵌入百度统计的代码,从而能够跟踪用户的访问行为。这种集成可以帮助你了解用户如何使用你的论坛,哪些页面欢迎,以及用户的来源和路径。
相关源码
-
(PC+WAP)生活资讯百科新闻门户类pbootcms网站模板为生活资讯、百科门户类企业打造的高性能网站模板,基于PbootCMS开源内核开发,采用HTML5响应式架构,PC与手机端实时数据同步,覆盖全终端用户浏览场景。查看源码 -
(自适应)包装机贴标机设备网站源码免费下载基于PbootCMS内核开发的响应式企业模板,为包装机械、贴标设备等工业领域打造,通过数字化展示提升企业专业形象。查看源码 -
(自适应响应式)HTML5甲醛环境检测网站模板带在线留言和资料下载本模板为甲醛检测与环保科技企业开发,采用PbootCMS内核构建。首页集成空气质量数据可视化模块,服务流程采用时间轴展示设计,检测报告板块支持PDF在线预览功能查看源码 -
(自适应)双语网络电子摄像头设备pbootcms网站模板下载核心功能定位:基于PbootCMS开发的双语摄像头企业官网模板,深度适配产品规格书展示、实时监控演示、解决方案呈现等业务场景,支持中英文内容一键切换。查看源码 -
(自适应)光伏测试仪器电站运维设备网站源码免费下载本模板为光伏检测设备与电站运维服务企业设计,采用PbootCMS内核开发,具备完整的设备展示、技术文档管理及客户服务功能模块。通过自适应结构与SEO优化框架,有效提升企业在移动端和搜索引擎中的专业形象。查看源码 -
(自适应响应式)英文外贸医疗科研耗材设备pbootcms网站模板为医疗设备和外贸企业设计的响应式网站模板,基于PbootCMS系统开发。突出医疗产品认证展示和国际化特性,通过专业化的产品参数展示模块和文档管理系统,满足医疗行业严格的信息披露要求。查看源码
| 分享笔记 (共有 篇笔记) |
