Linux CentOS7使用rpm方式安装nginx

Nginx sxdgy 175℃

需要使用编译方式安装,清访问:Centos源码编译安装配置Nginx

1、查询是否已经安装了nginx

rpm -qa|grep nginx
#如果有安装了 ,执行rpm -e nginx卸载

2、下载nginx rpm包并安装

get http://nginx.org/packages/centos/7/x86_64/RPMS/nginx-1.18.0-1.el7.ngx.x86_64.rpm
#也可去http://nginx.org/packages/centos/7/x86_64/RPMS/找合适的版本
rpm -ivh nginx-1.18.0-1.el7.ngx.x86_64.rpm
#默认安装位置/etc/nginx/,配置文件/etc/nginx/nginx.conf

3、启动、重启、停止nginx

systemctl start nginx
systemctl status nginx
systemctl stop nginx

4、设置开机自启动

systemctl enable nginx
systemctl list-unit-files|grep nginx

转载请注明:零五宝典 » Linux CentOS7使用rpm方式安装nginx