您现在的位置是:首页 > 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核心函数库function_core的函数注释
* 系统错误处理* @param$message 错误信息* @param $show 是否显示信息* @param $save 是否存入日志* @param $halt 是否中断访问
Discuz用户头像上传异常的原因及解决方法
最近有不少朋友问我关于Discuz用户头像上传异常的问题,这确实是个让人头疼的痛点。在处理Discuz用户头像上传异常时,首先要搞清楚问题出在哪里。
discuz X2.5文件结构说明文档
|-- /source/function DX自定义函数库|--/function_admincp.php 后台各项处理函数|--/function_attachment.php 附件类处理函数
discuz模板调用方法和语言标签使用方法示例
工作中遇到一个小问题,discuz的手机模板中,需要切换收藏和取消收藏。取消收藏,需要找到forum/viewthread.htm 、forum/viewthread_node.htm 模板
相关源码
-
(自适应)代理记账财务会计咨询服务个人公司网站模板该响应式网站模板为代理记账、财政咨询及财务会计类企业设计,基于PbootCMS内核开发。通过自适应手机端的HTML5技术,帮助企业高效构建专业财税服务平台查看源码 -
(自适应)大型农业机械设备水稻玉米收割机网站pbootcms源码下载本模板基于PbootCMS内核开发,为农业机械设备制造与销售企业设计,特别适合水稻玉米收割机、拖拉机、播种机等农用机械展示。模板充分考虑了农机行业的特性,从产品展示到技术参数,从作业案例到售后服务查看源码 -
(自适应)html5导航目录索引工具类网站源码下载本模板基于PbootCMS开发,为站长导航、网址导航类网站设计。采用HTML5+CSS3技术构建,适配PC端和移动端,提供流畅的浏览体验。适用于个人站长、资源导航平台等场景查看源码 -
pbootcms模板(PC+WAP)火锅加盟餐饮美食类带留言源码基于PbootCMS内核深度开发,为火锅、餐饮品牌打造的营销型解决方案。采用红色主题传递行业活力,实现PC与WAP端适配。查看源码 -
(自适应)行业协会工会机构单位pbootcms网站源码本模板基于PbootCMS内核开发,为行业协会、工会组织及机构单位量身打造。采用响应式布局设计,可自动适配手机、平板等移动设备,数据实时同步更新。模板包含行业资讯查看源码 -
WordPress个人博客主题 - wp-Concise-v1.0免费下载wp-Concise-v1.0是一款专为个人博客设计的简约风格主题,采用全宽排版设计理念,注重内容呈现效果。该模板适用于个人随笔、技术分享、生活记录等博客场景,帮助用户打造专业的内容展示空间。查看源码
| 分享笔记 (共有 篇笔记) |
