在线安装:
yum install -y nginx
离线安装
下载Nginx RPM:Index of /packages/centos/7/x86_64/RPMS/ http://nginx.org/packages/centos/7/x86_64/RPMS/
wget http://nginx.org/packages/centos/7/x86_64/RPMS/nginx-1.18.0-1.el7.ngx.x86_64.rpm
下载完成后安装,在安装之前首先安装openssl
yum install -y nginx-1.18.0-1.el7.ngx.x86_64.rpm
或者
rpm -ivh nginx-1.18.0-1.el7.ngx.x86_64.rpm
nginx服务
1、systemd管理 查看服务状态 systemctl status nginx.service 启动服务 systemctl start nginx.service 开机自启 systemctl enable nginx.service 重启服务 systemctl start nginx.service 2、nginx bin管理 查看版本 nginx -v 检测配置 nginx -t -c /usr/nginx/conf/nginx.conf /usr/nginx/sbin/nginx -t 重新加载配置 nginx -s reload /usr/nginx/sbin/nginx -s reload
防火墙设置
关闭
systemctl stop firewalld.service
关闭开机自启
systemctl disable firewalld.service