centos7 安装 nginx

安装必要的插件

yum install -y gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel

下载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源安装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
原文地址:https://www.cnblogs.com/lishanglin/p/12555992.html