[建站_2]怎能没有Nginx
更新
sudo yum install yum-utils
在"/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
[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
sudo yum-config-manager --enable nginx-mainline
sudo yum install nginx
不管怎么说,nodejs都被我搞定了,还有什么不能继续?
按照之前和M先生的沟通,Nginx走起
科普 什么是Nginx
维基 Nginx
Nginx(发音同engine x)是一个网页服务器,它能反向代理HTTP, HTTPS, SMTP, POP3, IMAP的协议链接,以及一个负载均衡器和一个HTTP缓存。
负载均衡服务器,邮件代理服务器.
更深入的资料,请阅读
还找到了taobao基于Nginx的web服务器项目,还在维护
Tengine是由淘宝网发起的Web服务器项目。它在Nginx的基础上,针对大访问量网站的需求,添加了很多高级功能和特性。Tengine的性能和稳定性已经在大型的网站如淘宝网,天猫商城等得到了很好的检验。它的最终目标是打造一个高效、稳定、安全、易用的Web平台。
从2011年12月开始,Tengine成为一个开源项目,Tengine团队在积极地开发和维护着它。Tengine团队的核心成员来自于淘宝、搜狗等互联网企业。Tengine是社区合作的成果,我们欢迎大家参与其中,贡献自己的力量。
安装
官方给的方法
Nginx
Pre-Built Packages for Mainline version
To set up the yum repository for RHEL/CentOS, create the file named /etc/yum.repos.d/nginx.repo with the following contents:
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/mainline/OS/OSRELEASE/$basearch/
gpgcheck=0
enabled=1
大概的意思在什么地方创建个文件,文件内容为xxx
echo -e "[nginx]\nname=nginx repo\nbaseurl=http://nginx.org/packages/mainline/OS/OSRELEASE/\$basearch/\ngpgcheck=0\nenabled=1" > /etc/yum.repos.d/nginx.repo
一句话解决战斗
![](https://img.haomeiwen.com/i2100241/97452f8bc81794f2.png)
没毛病,继续
yum install nginx
出现报错
![](https://img.haomeiwen.com/i2100241/3fbdcae1bb2d3f5a.png)
仔细研究了一下系统的说明,人家需要进行一定的补充...
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.
最终改为:
echo -e "[nginx]\nname=nginx repo\nbaseurl=http://nginx.org/packages/mainline/centos/\$releasever/\$basearch/\ngpgcheck=0\nenabled=1" > /etc/yum.repos.d/nginx.repo
OS 替换当前系统名称, OSRELEASE 替换为系统的参数$releasever
![](https://img.haomeiwen.com/i2100241/1706c9aa9fa6186a.png)
感谢这两篇文章带给我的思路
http://linuxlearn.blog.51cto.com/1437234/1683709
https://my.oschina.net/VincentJiang/blog/224993
使用yum install nginx -y
安装
![](https://img.haomeiwen.com/i2100241/697ac81237b24639.png)
配置
运行 nginx提示
![](https://img.haomeiwen.com/i2100241/723d017a94600e39.png)
找了找资料
参考
http://www.hankcs.com/appos/linux/fix-nginx-bind-err.html
首先...配置文件的位置不太一样了~
![](https://img.haomeiwen.com/i2100241/3df5819d17394db5.png)
然后,内容不太一样
![](https://img.haomeiwen.com/i2100241/b32b4b3a28ee39b7.png)
感觉这个说法有点呵呵
但,我根据他的说法,查了一下端口的占用,然后杀掉nginx,重新启动...结果,牛逼了~好了....
![](https://img.haomeiwen.com/i2100241/af88e8b4520e02a6.png)
![](https://img.haomeiwen.com/i2100241/53de957dbfa3333d.png)
请撒花鼓掌,棒棒哒!!!
![](https://img.haomeiwen.com/i2100241/7055e8937321fc9d.png)