1、首先对服务器进行一次大的更新操作
yum -y update
yum install epel-release
2、下载对应要安装的nginx版本
yum -y install pcre-devel
yum -y install openssl openssl-devel
先添加要运行的用户
useradd -s /sbin/nologin -r www
wget http://nginx.org/download/nginx-1.19.2.tar.gz
正常安装...
./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_v2_module --with-http_gzip_static_module --with-http_sub_module --with-stream --with-stream_ssl_module --with-openssl-opt='enable-weak-ssl-ciphers'
make && make install
编写启动脚本
[Unit] Description=nginx After=network.target remote-fs.target nss-lookup.target [Service] Type=forking PIDFile=/usr/local/nginx/logs/nginx.pid ExecStartPost=/bin/sleep 0.1 ExecStartPre=/usr/local/nginx/sbin/nginx -t -c /usr/local/nginx/conf/nginx.conf ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf ExecReload=/bin/kill -s HUP $MAINPID ExecStop=/bin/kill -s QUIT $MAINPID PrivateTmp=true [Install] WantedBy=multi-user.target
开机启动
-
开机自启:
-
systemctl enable nginx.service
-
关闭开机自启:
-
systemctl disable nginx.service
安装php-fpm
安装基础依赖
yum install -y gcc gcc-c++ make zlib zlib-devel pcre pcre-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers