疯子好好活

yum安装nginx

发布时间:2017年2月20日 / 分类:Linux / 211 次围观 / 抢沙发!

nginx官网有设置yum源的文档。http://nginx.org/en/linux_packages.html#stable

还是先检查一下,执行yum info nginx

Loaded plugins: security
Available Packages
Name : nginx
Arch : x86_64
Version : 1.10.2
Release : 1.el6
Size : 462 k
Repo : epel
Summary : A high performance web server and reverse proxy server
URL : http://nginx.org/
License : BSD
Description : Nginx is a web server and a reverse proxy server for HTTP, SMTP, POP3 and

        : IMAP protocols, with a strong focus on high concurrency, performance and low
        : memory usage.

有包,而且版本也满足需求,直接安装。


安装好之后启动报错:

Starting nginx: nginx: [emerg] socket() [::]:80 failed (97: Address family not supported by protocol)

        [FAILED]

搜索一番得知是因为在80端口同时监听了IPV4和IPV6,然后好像IPV6不支持?
解决方法如下:
nginx -t找到配置文件位置,然后去conf.d文件夹找到default.conf

server {
    listen       80 default_server;
    listen       [::]:80 default_server;
    server_name  _;
    ...
}

listen [::]:80 default_server;前面加#注释掉

标签:没有标签呢