nginx下载地址:http://nginx.org/en/download.html
上传到opt/soft
目录
cd /opt/soft
tar -zxvf nginx-1.17.0.tar.gz
cd nginx-1.17.0
yum install -y gcc
yum install -y pcre pcre-devel
yum install -y zlib zlib-devel
yum install -y openssl openssl-devel
./configure --with-http_ssl_module --with-pcre --with-stream --with-stream_ssl_module --with-http_ssl_module --with-http_v2_module --with-threads
make && make install
开启启动配置
vi /etc/rc.d/rc.local
#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.
touch /var/lock/subsys/local
#增加下面这一行,如果你的nginx也安装在这个位置的话。
/usr/local/nginx/sbin/nginx
检查/etc/rc.d/rc.local
是否为可执行文件
chmod +x /etc/rc.d/rc.local