一、编译安装Nginx
# cd /usr/local/src
# wget http://nginx.org/download/nginx-1.16.0.tar.gz
# tar -zxvf nginx-1.16.0.tar.gz
# cd nginx-1.16.0
# yum install -y gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel
# ./configure --prefix=/usr/local/nginx --sbin-path=/usr/local/nginx/sbin/nginx --conf-path=/usr/local/nginx/conf/nginx.conf --pid-path=/usr/local/nginx/run/nginx.pid --lock-path=/usr/local/nginx/run/nginx.lock --http-client-body-temp-path=/usr/local/nginx/run/client_body_temp --http-proxy-temp-path=/usr/local/nginx/run/proxy_temp --http-fastcgi-temp-path=/usr/local/nginx/run/fastcgi_temp --http-uwsgi-temp-path=/usr/local/nginx/run/uwsgi_temp --http-scgi-temp-path=/usr/local/nginx/run/scgi_temp --http-log-path=/usr/local/nginx/log/access.log --error-log-path=/usr/local/nginx/log/error.log --with-debug --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_degradation_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-pcre --with-pcre-jit --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module
# make
# make install
安装完毕,启动/关闭/重启Nginx命令如下:
# /usr/local/nginx/sbin/nginx //启动
# /usr/local/nginx/sbin/nginx -s stop //关闭
# /usr/local/nginx/sbin/nginx -s reload //重启
附带:查看启动状态
# ps -ef | grep nginx
设置Nginx开机启动(参考自:https://www.jianshu.com/p/ca5ee5f7075c)
# vi /usr/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
ExecReload=/usr/local/nginx/sbin/nginx -s reload
PrivateTmp=true
[Install]
WantedBy=multi-user.target
保存上述脚本文件,然后设置Nginx开机启动
# systemctl enable nginx.service
重启系统
# reboot
查看Nginx是否开机启动成功,在浏览器输入:http://localhost
二、编译安装PHP 7.4
# cd /usr/local/src
原文:https://www.cnblogs.com/lihailin9073/p/11173537.html