> CentOS > CentOS教程 >

Centos7 yum安装nginx

安装准备依赖lib库
yum install gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel

安装Nginx
安装之前,检查一下是否已经安装有nginx

find -name nginx

如果系统已经安装了nginx,那么就先卸载

yum remove nginx

yum安装nginx
新建
/etc/yum.repos.d/nginx.repo
添加以下,以centos7为例

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/mainline/rhel/7/$basearch/
gpgcheck=0
enabled=1

rpm –import http://nginx.org/keys/nginx_signing.key

yum install nginx
/bin/systemctl status nginx.service

(责任编辑:IT)