centos7 安装 nginx
一、准备工作
-
安装必要的插件
yum install -y gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel
二、nginx 源码安装
-
下载nginx安装包
wget https://nginx.org/download/nginx-1.14.0.tar.gz`
-
解压安装包
tar zxvf nginx-1.14.0.tar.gz`
-
confiure
./configure
-
编译和编译安装
make && make install
-
启动,重载与关闭
- 启动
./sbin/nginx
- 重载
./sbin/nginx -s reload
- 关闭
pkill -9 nginx
- 启动
三、yum源 安装
-
yum源安装nginx
yum install -y nginx
-
查看
nginx
状态systemctl status nginx
-
启动
nginx
服务systemctl start nginx
-
重启
nginx
服务systemctl restart nginx
-
关闭
nginx
服务systemctl stop nginx
-
设置开机启动
systemctl start nginx systemctl enable nginx
-
至此 yum源安装
nginx
完毕