CentOS安装Nginx
利用yum 命令, 可以简化Nginx的安装
本来可以一句:
yum install nginx --installroot=/usr/local/nginx
很遗憾报错了
1 YumRepo Error: All mirror URLs are not using ftp, http[s] or file. 2 Eg. $releasever is not a valid and current release or hasnt been released yet/ 3 removing mirrorlist with no valid mirrors: /usr/local/nginx/var/cache/yum/x86_64/$releasever/base/mirrorlist.txt 4 错误:Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again
看了官方, 是这么说的
To set up the yum repository for RHEL/CentOS, create the file named /etc/yum.repos.d/nginx.repo
with the following contents:
Replace “OS
” with “rhel
” or “centos
”, depending on the distribution used, and “OSRELEASE
” with “5
”, “6
”, or “7
”, for 5.x, 6.x, or 7.x versions, respectively.
[nginx] name=nginx repo baseurl=http://nginx.org/packages/mainline/OS/OSRELEASE/$basearch/ gpgcheck=0 enabled=1