2014-12-18 4 views
-2

SSL로 내 사이트를 열려고하면 ERR_CONNECTION_RESET 오류가 발생합니다.SSL 용 Nginx 구성

로그에 정보가 없습니다.

방화벽에서 포트 443이 열려 있습니다. http에서 모두 잘 작동합니다.

CentOS7 (리눅스 domain.com 3.10.0-123.9.3.el7.x86_64 # 1 SMP 목 십일 6 세계 협정시 15시 06분 3초 2014 x86_64에의 x86_64에의 x86_64의 GNU/리눅스)

의 nginx 버전 : nginx를/1.6.2

은 OpenSSL 1.0.1e-FIPS 2013년 2월 11일 여기

내의 nginx 설정 파일입니다 :

server { 
    listen 80; 
    listen 443 ssl; 

    server_name domain.com www.domain.com; 

    #SSL config 
    ssl on; 
    ssl_certificate /etc/nginx/ssl/domain.crt; 
    ssl_certificate_key /etc/nginx/ssl/domain.key; 
    ssl_session_cache shared:SSL:10m; 
    ssl_session_timeout 10m; 
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2; 
    ssl_ciphers "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH EDH+aRSA !RC4 !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS"; 
    ssl_prefer_server_ciphers on; 
    ssl_stapling on; 
    resolver 8.8.8.8; 
    ssl_stapling_verify on; 

    root /home/main/www; 
    access_log /var/log/nginx/domain.com-access.log main buffer=16k; 
    error_log /var/log/nginx/domain.com-dev-error.log warn; 

    location = /favicon.ico { 
     log_not_found off; 
     access_log off; 
    } 

    location = /robots.txt { access_log off; log_not_found off; } 
    location ~ /\.   { access_log off; log_not_found off; deny all; } 
    location ~ ~$   { access_log off; log_not_found off; deny all; } 

    location ~* .(js|css|png|jpg|jpeg|gif|ico|xml|swf|flv|eot|ttf|woff|pdf|xls|htc|html|unity3d)$ { 
    add_header Pragma "public"; 
    add_header Cache-Control "public, must-revalidate, proxy-revalidate"; 
    access_log off; 
     log_not_found off; 
     expires 360d; 
    } 

    location ~ /.ht { 
     deny all; 
     access_log off; 
     log_not_found off; 
} 

    location ~* \.php$ { 
     #rewrite ^/(.*)/$ /$1 permanent; 
     fastcgi_split_path_info ^(.+.php)(.*)$; 
     fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
     fastcgi_param SCRIPT_NAME $fastcgi_script_name; 
     fastcgi_param PATH_INFO $fastcgi_path_info; 
     fastcgi_index index.php; 
     fastcgi_pass unix:/var/run/php5-fpm.sock; 
     include  /etc/nginx/fastcgi_params; 
    } 

    location/{ 
    index index.php; 
    try_files $uri /index.php?$args; 
    } 
} 

텔넷 결과 :

[[email protected] ~]$ telnet domain.com 80 
Trying 123.45.67.89... 
Connected to domain.com. 
Escape character is '^]'. 
^] 
HTTP/1.1 400 Bad Request 
Server: nginx/1.6.2 
Date: Thu, 18 Dec 2014 13:13:20 GMT 
Content-Type: text/html 
Content-Length: 172 
Connection: close 

<html> 
<head><title>400 Bad Request</title></head> 
<body bgcolor="white"> 
<center><h1>400 Bad Request</h1></center> 
<hr><center>nginx/1.6.2</center> 
</body> 
</html> 
Connection closed by foreign host. 
[[email protected] ~]$ telnet domain.com 443 
Trying 123.45.67.89... 
Connected to domain.com. 
Escape character is '^]'. 
Connection closed by foreign host. 

문제가 해결되었습니다. 나는 글로벌 설정 파일 라인에서 찾을 수있다 :

server { listen 443 ssl; server_name _; access_log off; error_log off; return 444; } 

제거한 후에도 문제가 없다.

+0

'에서 netstat -tulpen의 출력을 보여주십시오 | 확인 nginx를 실제로의 error_log에 오류가 포트 443 ALOS에서 수신 할 GREP을 443'? –

+0

tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 0 17055261 29781/nginx : master –

답변

-1

"Listen 443 ssl"이 중복되어 보입니다. "Listen 443"을 넣어야합니다 (나중에 config에 "ssl on"을 유지하십시오).

+0

이미 시도하십시오 ... 변경되지 않습니다. –

+0

[더 이상 지원되지 않습니다.] (http://nginx.org/en/docs/http/configuring_https_servers.html) : "0.7.14 이전에는 위의 그림과 같이 개별 수신 소켓 용으로 SSL을 선택적으로 사용할 수 없었습니다. SSL은 ssl 지시문을 사용하여 전체 서버에 대해서만 활성화 될 수 있으므로 단일 HTTP/HTTPS 서버를 설정할 수 없습니다.이 문제를 해결하기 위해 listen 지시문의 ssl 매개 변수가 추가되었습니다. 현대 버전에서 ssl 지시어 사용 따라서 낙심한다. " – Kellen

0

듣기 433 ssl이이 설정에서 정확합니다. 정규 및 SSL 정의가 동일한 블록에있을 수 있지만 포트 443 요청에 대해서만 ssl을 활성화하도록 nginx에 지시합니다.

문제는 인증서 파일에있을 수 있습니다. 같은 질문에이 질문을 확인하십시오 SSL configuration on nginx 1.6

1

문제가 해결되었습니다. 나는 글로벌 설정 파일 라인에서 찾을 수있다 :

server { listen 443 ssl; server_name _; access_log off; error_log off; return 444; } 

제거한 후에도 문제가 없다.

- Guliy 보리스가