当然是官方的指导方法,以下方法来自
http://nginx.org/en/linux_packages.html#RHEL-CentOS
主要内容搬家如下:
首先安装:
yum install yum-utils
然后建立repository, 内容如下
vim /etc/yum.repos.d/nginx.repo
拷贝如下内容:
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true
[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true
上面是默认方式安装稳定版本,如果想安装主线版本,运行如下命令:
yum-config-manager --enable nginx-mainline
安装 nginx , 运行如下命令
yum install nginx
等一会儿,到
/usr/sbin
运行:
./nginx
检查一下:
ps -ef|grep nginx
得到:
root 66791 1 0 09:42 ? 00:00:00 nginx: master process ./nginx
nginx 66792 66791 0 09:42 ? 00:00:00 nginx: worker process
nginx 66793 66791 0 09:42 ? 00:00:00 nginx: worker process
nginx 66794 66791 0 09:42 ? 00:00:00 nginx: worker process
nginx 66795 66791 0 09:42 ? 00:00:00 nginx: worker process
nginx 66796 66791 0 09:42 ? 00:00:00 nginx: worker process
nginx 66797 66791 0 09:42 ? 00:00:00 nginx: worker process
nginx 66798 66791 0 09:42 ? 00:00:00 nginx: worker process
nginx 66799 66791 0 09:42 ? 00:00:00 nginx: worker process
nginx 66800 66791 0 09:42 ? 00:00:00 nginx: worker process
nginx 66801 66791 0 09:42 ? 00:00:00 nginx: worker process
nginx 66802 66791 0 09:42 ? 00:00:00 nginx: worker process
nginx 66803 66791 0 09:42 ? 00:00:00 nginx: worker process
说明安装成功。
是记
MaraSun BJFWDQ