查看是否安装nginx
#使用命令 rpm -qa|grep 列出需要卸载的软件包
rpm -qa | grep nginx
卸载nginx
#使用rpm -e 加包名删除 rpm -e nginx-release-centos-7-0.el7.ngx.noarch nginx-1.14.1-1.el7_4.ngx.x86_64
rpm -e nginx
安装nginx
其他版本步骤一样
下载rpm包Index of /packages/centos/7/x86_64/RPMS/
#使用root权限进行安装 rpm -ivh nginx-1.19.5-1.el7.ngx.x86_64.rpm
rpm -ivh nginx-1.16.1-1.el7.ngx.x86_64.rpm
启动Nginx并设置开机启动
systemctl start nginx.service
systemctl enable nginx.service
查看Nginx启动状态
systemctl status nginx.service
修改nginx配置文件
位置 :/etc/nginx/nginx.conf
FAQ
如果报缺少libcrypto.so.10
wget http://rpmfind.net/linux/centos/7.9.2009/os/x86_64/Packages/openssl-libs-1.0.2k-19.el7.x86_64.rpm
rpm -ivh openssl-libs-1.0.2k-19.el7.x86_64.rpm --force
# 下载地址 http://rpmfind.net/linux/rpm2html/search.php?query=libcrypto.so.10%28OPENSSL_1.0.2%29%2864bit%29&submit=Search+...&system=centos+7&arch= [root@ /home/kiosk/repod]# rpm -ivh openssl-libs-1.0.2k-19.el7.x86_64.rpm --force
warning: openssl-libs-1.0.2k-16.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY Preparing... ################################# [100%] Updating / installing... 1:openssl-libs-1:1.0.2k-16.el7 ################################# [100%]