一、需求说明及搭建环境
1.1需求说明:
1)访问方式:http://域名
2)账户:admin
3)密码:Aa6870608
4)wordpress版本:6.6
5)主题/插件:可通过后台安装插件及主题
1.2搭建环境
1)系统:Rocky9
2)nginx:1.24
3) mysql5.7.38
4) php7.4.28
二、LNMP环境编译
2.1准备编译环境修改系统
1)关闭防火墙:
systemctl stop firewalld
systemctl disable firewalld
systemctl disable –now firewalld
2)关闭selinux
setenforce 0
vim /etc/sysconfig/selinux
2.2编译Nginx
2.2.1安装必要组件
yum install -y gcc gcc-c++ make pcre pcre-devel zlib zlib-devel openssl openssl-devel
2.2.2创建www目录并且下载nginx编译包
cd /www
wget http://nginx.org/download/nginx-1.24.0.tar.gz
tar -zxvf nginx-1.24.0.tar.gz
如出现上面提示请执行 yum install tar -y
2.2.3新建用户及用户组
groupadd nginx
useradd -r -g nginx -s /bin/false nginx
2.2.4编译
./configure \
–prefix=/www/nginx \
–user=nginx \
–group=nginx \
–with-threads \
–with-file-aio \
–with-http_ssl_module \
–with-http_realip_module \
–with-http_gzip_static_module
2.2.5编译完成之后
make -j 4 && make -j 4 install
2.2.6配置nginx环境变量
vim /etc/profile
尾行添加变量:export PATH=$PATH:/www/nginx/sbin
source /etc/profile
nginx -v
2.2.7systemctl管理nginx
vim /usr/lib/systemd/system/nginx.service
[Unit]
Description=nginx
After=network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
ExecStart=/www/nginx/sbin/nginx
ExecReload=/www/nginx/sbin/nginx -s reload
ExecStop=/www/nginx/sbin/nginx -s stop
[Install]
WantedBy=multi-user.target
启动nginx
systemctl start nginx
systemctl enable nginx
systemctl status nginx
到此我们的nginx暂时就手工编译完成了,接下来我们需要配置nginx了,下期我们再继续 配置nginx教程:https://www.server7.cc/2024/08/11/129.html