Centos7 Nginx 安装
下载地址:http://nginx.org/download/nginx-1.18.0.tar.gz
1、准备工作
#安装gcc yum install gcc-c++ #安装pcre pcre-devel yum install -y pcre pcre-devel #安装zlib库 yum install -y zlib zlib-devel #安装OpenSSL yum install -y openssl openssl-devel
2、下载安装nginx
cd /usr/local/bin wget http://nginx.org/download/nginx-1.18.0.tar.gz tar -zxvf nginx-1.18.0.tar.gz cd nginx-1.18.0 ./configure make make install
3、配置开机启动
#新建service vi /lib/systemd/system/nginx.service [Unit] Description=nginx After=network.target [Service] Type=forking ExecStart=/usr/local/nginx/sbin/nginx ExecReload=/usr/local/nginx/sbin/nginx -s reload ExecStop=/usr/local/nginx/sbin/nginx -s quit PrivateTmp=true [Install] WantedBy=multi-user.target
systemctl enable nginx.service