下载离线包: 用浏览器打开地址,选择您要下载的版本:http://nginx.org/packages/centos/7/x86_64/RPMS/ 执行安装: 将下载的rpm包上传到服务器,然后赋予可执行权限,执行安装。
yum install -y nginx-1.16.1-1.el7.ngx.x86_64.rpm
启动Nginx并设置开机启动
sudo service nginx start
sudo systemctl start nginx.service
sudo systemctl enable nginx.service
查看Nginx启动状态
sudo service nginx status
sudo systemctl status nginx.service
查看Nginx位置:
whereis nginx
sudo whereis nginx
默认安装则配置文件一般是这个:/etc/nginx/nginx.conf 卸载Nginx
yum remove nginx
检查配置文件是否正确
nginx -t -c /usr/nginx/conf/nginx.conf
/usr/nginx/sbin/nginx -t
重启Nginx
nginx -s reload
/usr/nginx/sbin/nginx -s reload
|