CentOS7离线安装Nginx及配置
下载离线包:
用浏览器打开地址,选择您要下载的版本:http://nginx.org/packages/centos/7/x86_64/RPMS/
如图,我下载的1.16.1版。
执行安装:
将下载的rpm包上传到服务器,然后赋予可执行权限,执行安装。
sudo 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版本
nginx -v
查看Nginx启动状态
sudo service nginx status sudo systemctl status nginx.service
如图为正在运行状态:
停止Nginx服务
查看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
安装后一般会自动创建nginx用户:
相关推荐
HanksWang 2020-11-10
yserver 2020-08-15
nginxs 2020-11-14
Guanjs0 2020-11-13
小木兮子 2020-11-11
yserver 2020-11-11
ssihc0 2020-11-11
windle 2020-11-10
liuchen0 2020-11-10
Freshairx 2020-11-10
ccschan 2020-11-10
liwf 2020-11-10
Guanjs0 2020-11-09
AderStep 2020-11-09
zrtlin 2020-11-09
mqfcu 2020-11-10