一、演示环境:
IP |
安装的程序包 |
版本 |
192.168.1.144 |
Nginx(epel源) |
1.10.2 |
5.3.3 |
||
PHP-fpm(FastCGI进程管理器) |
||
192.168.1.145 |
MysqL-server-5.6.39-1.el6.x86_64.rpm MysqL-client-5.6.39-1.el6.x86_64.rpm MysqL-devel-5.6.39-1.el6.x86_64.rpm MysqL-shared-5.6.39-1.el6.x86_64.rpm MysqL-shared-compat-5.6.39-1.el6.x86_64.rpm |
5.6.39 |
备注:CentOS 6.9中yum方式安装的MysqL版本默认为5.1.73,此处使用版本为5.6.39的rpm包安装MysqL
二、搭建LNMP:
1、安装前准备:
(1)校对服务器时间
(2)配置epel源
2、安装Nginx:# yum -y install Nginx # service Nginx start # ss -tunlp | grep :80
配置文件:
Ø 辅助配置文件:/etc/Nginx/*、/etc/Nginx/conf.d
3、 安装PHP:# yum -y install PHP,配置文件:/etc/PHP.ini
4、 安装配置PHP-fpm:
# yum -y install PHP-fpm
# vim /etc/PHP-fpm.d/www.conf,修改以下参数的值:
listen = 192.168.1.144:9000 //PHP-fpm监听的地址端口
listen.allowed_clients = 192.168.1.144 //允许连接的FastCGI客户端地址
user = Nginx
group = Nginx
# service PHP-fpm start
# ss -tunlp | grep :9000
配置文件:
Ø 辅助配置文件:/etc/PHP-fpm.d/www.conf
5、 安装配置MysqL:
# rpm -qa | grep -i MysqL //检查旧版本MysqL相关组件是否安装
# yum -y remove MysqL-libs*
//切换至存放MysqL-client-5.6.39-1.el6.x86_64.rpm、MysqL-server-5.6.39-1.el6.x86_64.rpm、MysqL-shared-compat-5.6.39-1.el6.x86_64.rpm、MysqL-devel-5.6.39-1.el6.x86_64.rpm、MysqL-shared-5.6.39-1.el6.x86_64.rpm的目录
# yum -y install *.rpm
# find / -name my*.cnf
# cp /usr/share/MysqL/my-default.cnf /etc/my.cnf //MysqL配置文件:/etc/my.cnf
# find / -name MysqL.server
# cp /usr/share/MysqL/MysqL.server /etc/init.d/MysqLd
# service MysqLd start
# ss -tunlp | grep :3306
# cat /root/.MysqL_secret //查看MysqL数据库root用户的随机密码
//修改root用户密码为123456、删除匿名用户、删除测试数据库、重载授权表
# MysqL_secure_installation
# MysqL -uroot -p
MysqL> grant all on *.* to 'root'@'192.168.%.%' identified by '123456'; //授权root用户远程登录
MysqL> flush privileges;
6、安装PHP-MysqL:# yum -y install PHP-MysqL
# cd /etc/Nginx/conf.d
# cp default.conf default.conf.bak
# vim default.conf
# service Nginx reload
# service PHP-fpm restart
三、测试LNMP:
# cd /usr/share/Nginx/html
# vim index.PHP
浏览器中输入http://192.168.1.144/index.PHP:
停止192.168.1.145上的MysqL:# service MysqLd stop
访问http://192.168.1.144
四、安装配置Discuz:
Discuz是腾讯旗下Comsenz公司推出的以社区为基础的专业建站平台,帮助网站实现一站式服务,让论坛(BBS)、个人空间(SNS)、门户(Portal)、群组(Group)、应用开放平台(Open Platform)充分融合于一体,帮助网站实现一站式服务。下载地址http://www.discuz.net/forum-10-1.html,此处以Discuz_X3.4_SC_UTF8.zip为例。
# yum -y install unzip
# unzip -q Discuz_X3.4_SC_UTF8.zip
# cp -r upload/ /usr/share/Nginx/html
# cd /usr/share/Nginx/html/upload
# chmod -R 777 config/ data/ uc_client/ uc_server/
# vim config/config_global_default.PHP
# vim config/config_ucenter_default.PHP
# MysqL -uroot -p
MysqL> create database dcdb;
MysqL> grant all on dcdb.* to 'dcuser'@'%' identified by "123456";
MysqL> flush privileges;
# MysqL -udcuser -p
MysqL> show databases;
修改Nginx配置文件,在index参数后新增index.PHP:
# vim /etc/Nginx/conf.d/default.conf
location / {
index index.PHP index.html index.htm;
}
# service Nginx reload
浏览器中输入http://192.168.1.144/upload/install/
点击“我同意”:
检查安装环境,全部通过后,点击“下一步”:
选择“全新安装Discuz! X(含UCenter Server)”,点击“下一步”:
点击“您的论坛已完成安装,点此访问”:
右上角可以使用admin账号登录:
# rm -rf /usr/share/Nginx/html/upload/install/index.PHP
# cd /usr/share/Nginx/html
# mv upload/ discuz
原文链接:https://www.f2er.com/centos/374469.html