nginx 出错
来源:互联网 发布:淘宝宝贝摄影兼职 编辑:程序博客网 时间:2024/06/05 05:07
【1】 nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
[::]:80 is a ipv6 address.
This error can be caused if you have a nginx configuration that is listening on port 80 and also on port [::]:80.
I had the following in my default sites-available file:
listen 80;
listen [::]:80 default_server;
You can fix this by adding ipv6only=on to the [::]:80 like this:
listen 80;
listen [::]:80 ipv6only=on default_server;
For more information, see:
http://forum.linode.com/viewtopic.php?t=8580
http://wiki.nginx.org/HttpCoreModule#listen
【2】 nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
[root@c7 nginx]# systemctl status nginx.service -l
nginx.service - The nginx HTTP and reverse proxy server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled)
Active: failed (Result: exit-code) since 二 2015-11-17 09:55:29 CST; 2s ago
Process: 4332 ExecStart=/usr/sbin/nginx (code=exited, status=1/FAILURE)
Process: 4329 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=0/SUCCESS)
Process: 4327 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)
11月 17 09:55:28 c7.c7 nginx[4332]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
11月 17 09:55:28 c7.c7 nginx[4332]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
11月 17 09:55:28 c7.c7 nginx[4332]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
11月 17 09:55:28 c7.c7 nginx[4332]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
11月 17 09:55:29 c7.c7 nginx[4332]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
11月 17 09:55:29 c7.c7 nginx[4332]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
11月 17 09:55:29 c7.c7 nginx[4332]: nginx: [emerg] still could not bind()
11月 17 09:55:29 c7.c7 systemd[1]: nginx.service: control process exited, code=exited status=1
11月 17 09:55:29 c7.c7 systemd[1]: Failed to start The nginx HTTP and reverse proxy server.
11月 17 09:55:29 c7.c7 systemd[1]: Unit nginx.service entered failed state.
[root@c7 nginx]# sudo fuser -k 80/tcp
80/tcp: 2964 2965 2966
[root@c7 nginx]# service nginx start
Redirecting to /bin/systemctl start nginx.service
[root@c7 nginx]# systemctl status nginx.service -l
nginx.service - The nginx HTTP and reverse proxy server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled)
Active: active (running) since 二 2015-11-17 09:56:13 CST; 6s ago
Process: 4367 ExecStart=/usr/sbin/nginx (code=exited, status=0/SUCCESS)
Process: 4363 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=0/SUCCESS)
Process: 4362 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)
Main PID: 4369 (nginx)
CGroup: /system.slice/nginx.service
├─4369 nginx: master process /usr/sbin/ngin
├─4370 nginx: worker proces
└─4371 nginx: worker proces
11月 17 09:56:13 c7.c7 systemd[1]: Starting The nginx HTTP and reverse proxy server…
11月 17 09:56:13 c7.c7 nginx[4363]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
11月 17 09:56:13 c7.c7 nginx[4363]: nginx: configuration file /etc/nginx/nginx.conf test is successful
11月 17 09:56:13 c7.c7 systemd[1]: Failed to read PID from file /run/nginx.pid: Invalid argument
11月 17 09:56:13 c7.c7 systemd[1]: Started The nginx HTTP and reverse proxy server.
[root@c7 nginx]#
【3】 Basic Authentication
[root@www ~]# yum -y install httpd-tools
[root@www ~]# vi /etc/nginx/conf.d/default.conf
add follows in “server” section
location /basic { auth_basic "Basic Auth"; auth_basic_user_file "/etc/nginx/.htpasswd";}
[root@www ~]# htpasswd -c /etc/nginx/.htpasswd fedora
New password: # set password
Re-type new password: # confirm
Adding password for user fedora
[root@www ~]# /etc/rc.d/init.d/nginx restart
Stopping nginx: [ OK ]
Starting nginx: [ OK ]
BASIC AUTH 未授权的错误
[src/connect.c_91_fetch_response]recv nothing
HTTP/1.1 401 Unauthorized
Server: nginx/1.6.3
Date: Tue, 17 Nov 2015 06:08:58 GMT
Content-Type: text/html; charset=utf-8,gbk
Content-Length: 194
Connection: close
WWW-Authenticate: Basic realm=”Restricted”
401 Authorization Required
401 Authorization Required
[root@c7 bin]#
rfc文档 https://tools.ietf.org/html/rfc7235#section-4.2
4.2. Authorization
The “Authorization” header field allows a user agent to authenticate
itself with an origin server – usually, but not necessarily, after
receiving a 401 (Unauthorized) response. Its value consists of
credentials containing the authentication information of the user
agent for the realm of the resource being requested.
Authorization = credentials
If a request is authenticated and a realm specified, the same
credentials are presumed to be valid for all other requests within
this realm (assuming that the authentication scheme itself does not
require otherwise, such as credentials that vary according to a
challenge value or using synchronized clocks).
A proxy forwarding a request MUST NOT modify any Authorization fields
in that request. See Section 3.2 of [RFC7234] for details of and
requirements pertaining to handling of the Authorization field by
HTTP caches.
- nginx 出错
- nginx 编译出错解决方法
- php nginx超时出错
- 安装nginx出错
- nginx安装出错
- nginx 502出错集锦
- nginx+uwsgi安装出错
- tp5 nginx url 出错
- osx编译安装nginx出错
- windows 安装nginx服务 出错
- ubuntu安装nginx服务器出错解决
- ubuntu 编译nginx时出错解决办法
- nginx 学习之检查配置文件是不是出错
- nginx不支持pathinfo 导致thinkphp出错解决办法
- nginx不支持pathinfo 导致thinkphp出错解决办法
- Nginx启动出错 error while loading shared libraries
- nginx php 上传大于15m文件出错
- mac下安装nginx+uwsgi+webpy出错解决
- 喜欢一个不同世界的人,那该有多难
- 概率学习(1)
- NHibernate 集合映射基础(第四篇)
- 虚拟机的封装
- JAVA BigDecimal.setScale 处理小数点
- nginx 出错
- 1076. Forwards on Weibo (30)
- 查询数据解析后的数据保存数据库上下拉多条目展示xlv
- 关于远程连接工具SSHSecure的使用
- Hexo 最常用的几个命令
- ubuntu16.04安装英伟达(NVIDIA)驱动——run文件安装
- 经典的神经网络-VGGNet
- linux常用命令四(系统管理类)
- 阿里云全球十四个节点评测分析及服务器地域选择攻略