安装环境:RHEL 7.9 + nginx 1.20.2 + mariadb-10.6.10 + php-8.0.25
备注:yum源为ISO自带镜像源,外加安装了rhel7 epel源,手动写epel.repo文件,源地址为https://dl.fedoraproject.org/pub/epel/7/x86_64/
# wget http://nginx.org/download/nginx-1.20.2.tar.gz
# yum -y install gcc pcre-devel zlib-devel
# tar xvf nginx-1.20.2.tar.gz && cd nginx-1.20.2/
# ./configure --prefix=/usr/local/nginx
# make -j4 && make install
# echo 'export PATH=$PATH:"/usr/local/nginx/sbin"' >> /etc/profile
# source /etc/profile
默认启动、停止命令为:① 启动:nginx ;② 停止:nginx -s stop
也可添加至系统服务以实现通过systemctl控制启动和停止
# cat << EOF > /lib/systemd/system/nginx.service
[Unit]
Description=nginx
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/nginx/sbin/nginx
ExecStop=/usr/local/nginx/sbin/nginx -s stop
[Install]
WantedBy=multi-user.target
EOF
# systemctl enable nginx.service --now
① 在防火墙中添加策略允许外部访问
# firewall-cmd --permanent --add-port=80/tcp
② 关闭防火墙
# systemctl stop firewalld.service
# systemctl disable firewalld.service
访问主页显示如下内容:
可在/usr/local/nginx/conf/nginx.conf中http部分添加以下内容:
server {
listen 192.168.11.101:8080;
access_log /usr/local/nginx/html/zabbix/logs/access.log;
error_log /usr/local/nginx/html/zabbix/logs/error.log;
root /usr/local/nginx/html/zabbix;
location / {
index index.html index.htm;
}
}
# wget http://mirrors.neusoft.edu.cn/mariadb/mariadb-10.6.10/source/mariadb-10.6.10.tar.gz
# rpm -e mariadb-libs --nodeps
# yum -y install gcc-c++ ncurses-devel bison libxml2-devel openssl-devel
此处需安装cma