nginx 오류

【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@c7nginx] \ # systemctl status nginx. service - l nginx. service - nginx HTTP 및 리 버스 프 록 시 서버 로드 됨: 로드 됨 (/ usr / lib / systemd / system / nginx. service; 비활성화 됨) 활성: 실패 함 (결과: 종료 코드) 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: 55: 29 c7. c7 systemd [1]: nginx. service: control process exited, code = exited status = 1 11 월 17: 55: 29 c7. c7 systemd [1]: 시작 실패 The nginx HTTP and reverse proxy server.[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 / SUCESS) Process: 4363 ExecStartPre = / usr / sbin / nginx - t (code = exited, status = 0 / SUCESS) Process: 4362 ExecStart Pre = / usr / bin / rm - f / run / nginx. pid (code = exited, status = 0 / SUCESS) 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 system [1]: 파일 / run / nginx. pid 에서 PID 를 읽 지 못 했 습 니 다. 잘못된 인수 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
nginx/1.6.3
[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.

좋은 웹페이지 즐겨찾기