目录
一、LNMP是什么
二、实际步骤
1.启用虚拟机
1.1 启动三台虚拟机分别命名为nginx,mysql,php
1.2 分别配置基础环境
1.3 测试外网连通性
2.更新源
3.安装nginx并配置
3.1 下载nginx源码包并安装
3.2 配置nginx
4.安装mysql并配置
4.1 安装mysql
4.2 更改root用户密码并启用远程登录
5.安装php并配置
5.1 安装新版本 PHP
5.2 配置php
6.连通测试
三、结果验证
1.解压并放置应用discuz
1.1 于php主机上解压应用源码包
1.2 nginx主机上解压应用源码包
2.登录discuz页面完成安装
Linux+Nginx+MySQL+PHP
关掉防火墙
关掉selinux
关掉网络图形化工具
rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
curl -O https://nginx.org/download/nginx-1.21.6.tar.gz
tar zxf nginx-1.21.6.tar.gz
cd nginx-1.21.6/
./configure --prefix=/usr/local/nginx && make && make install
注:若有依赖缺失,按照提示安装即可
vim /usr/local/nginx/conf/nginx.conf
cd /usr/local/nginx/
sbin/nginx
yum install -y mysql
wget https://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
rpm -ivh mysql57-community-release-el7-8.noarch.rpm
yum -y install mysql-server
systemctl restart mysqld
grep 'temporary password' /var/log/mysqld.log
mysql -uroot -poSXoXa+4,/p,
alter user user() identified by "1234.Com";
drop user 'root'@'localhost';
create user 'root'@'%' identified by '1234.Com'
yum install php72w php72w-cli php72w-common php72w-devel php72w-embedded php72w-fpm php72w-gd php72w-mbstring php72w-mysqlnd php72w-opcache php72w-pdo php72w-xml php72w-ldap php72w-mcrypt
查看版本php -v
vim /etc/php-fpm.d/www.conf
mkdir /usr/local/nginx/html -p
vim /usr/local/nginx/html/index.php
systemctl start php-fpm
mv Discuz_X3.5_SC_UTF8_20230726.zip /opt
cd /opt
unzip Discuz_X3.5_SC_UTF8_20230726.zip
rm -f /usr/local/nginx/html/index.php
mv upload/* /usr/local/nginx/html/
chown -R apache /usr/local/nginx/html/*
mv Discuz_X3.5_SC_UTF8_20230726.zip /opt
cd /opt
unzip Discuz_X3.5_SC_UTF8_20230726.zip
rm -f /usr/local/nginx/html/index.php
mv upload/* /usr/local/nginx/html/
useradd -s /sbin/nologin nginx -M
chown -R nginx /usr/local/nginx/html/*