您现在的位置是:首页 > 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论坛模块通用函数代码实例
/***[Discuz!] (C)2001-2099 Comsenz Inc.*This is NOT a freeware, use is subject to license terms
Discuz & UCenter修改手记
最近在整JAVA和UCENTER的东西,受限于项目架构需要,无法完全以UCENTER为中心,所以在对接过程中遇到了许多不愉快的事情。经历多番研究,终于解决了其中了两个大问题
discuz注册账号的方法步骤
注册 Discuz 账号的步骤:1. 访问 Discuz 官网;2. 点击“注册”按钮;3. 填写注册信息,包括用户名、密码、邮箱地址等;4. 同意条款和隐私政策;5. 点击“注册”按钮;6. 账号;7. 使用用户名和密码登录论坛。
discuz获取任意管理员密码漏洞利用工具vbs版
本打算考虑写个python版的,考虑大家的机器环境还是弄了个vbs版也利于修改以下是search.inc.php 文件漏洞利用代码VBS版
相关源码
-
(响应式)蓝色智能摄像头安防防盗电子设备免费pbootcms源码下载这是一款针对智能安防行业特点设计的网站模板,采用蓝色系配色方案,体现科技感和安全性。模板包含产品展示、解决方案、技术支持和新闻中心等核心模块,能够全面展示智能安防设备的技术特点和行业应用。查看源码 -
pbootcms模板(PC+WAP)微信小程序开发公司网站本模板为微信小程序开发代理、软件开发公司等企业设计,基于PbootCMS内核开发,支持PC+WAP双端响应式布局,数据实时同步,适用于多行业快速建站。查看源码 -
(自适应html5)重工业钢铁机械设备网站pbootcms响应式模板下载为重工业领域打造的响应式网站模板,助力企业高效展示产品与服务,基于PbootCMS开发的工业级网站模板,特别适合钢铁制造、机械设备生产等重工业企业使用。查看源码 -
(响应式)WordPress主题Ripro9.0博客免扩展二开版RiPro9.0是基于RiPro8.9版本深度二开优化的资源付费主题,源码修正,修复原版多处功能异常,确保系统稳定运行。支持虚拟主机环境部署,无需特殊服务器配置。查看源码 -
(自适应响应式)HTML5幕墙装饰工程建筑装修公司pbootcms模板下载基于PbootCMS开发的响应式模板,为幕墙工程、建筑装饰企业设计,通过数字化展示提升企业专业形象与项目展示能力。结构化数据标记增强项目案例收录,智能URL路由优化,支持每个工程案例独立设置关键词与描述查看源码 -
(自适应)品牌策划网络设计作品公司个人pbootcms网站源码下载本款基于PbootCMS开发的网站模板专为品牌策划、设计公司打造,特别适合展示创意作品、设计案例和企业服务。模板采用现代化设计风格查看源码
| 分享笔记 (共有 篇笔记) |
