OS: Ubuntu 20.04 Virtualmin + Nginx + PHP-FPM 설치
모든 것이 잘 설정되었지만 Letsencrypt(한도 도달)가 아닌 SSL 인증서 3개월 평가판(완전히 유효한 인증서)을 설치했을 때 모든 것이 완벽하게 작동했지만 Cloudflare로 전환하면 521 서버를 찾을 수 없어 웹 사이트가 충돌했습니다. 운 없이 유연, 전체, 전체(엄격)와 같은 다른 옵션으로 전환을 시도했습니다.
명령
tail -f /var/log/nginx/error.log
로그 파일에 많은 오류가 있습니다.
root@server:~# tail -f /var/log/nginx/error.log
2020/12/29 21:59:05 [emerg] 6813#6813: bind() to 2xx.2xx.xx3.xxx:443 failed (98: Address already in use)
2020/12/29 21:59:05 [emerg] 6813#6813: bind() to [2xxx:a1xx:xxxx:8xxx::1]:443 failed (98: Address already in use)
2020/12/29 21:59:05 [emerg] 6813#6813: still could not bind()
2020/12/29 22:31:47 [emerg] 512#512: cannot load certificate “/home/example/ssl.cert”: BIO_new_file() failed (SSL: error:02001002:system library:fopen:No such file or directory:fopen(’/home/example/ssl.cert’,‘r’) error:2006D080:BIO routines:BIO_new_file:no such file)
2020/12/29 22:32:37 [emerg] 1986#1986: cannot load certificate “/home/example/ssl.cert”: BIO_new_file() failed (SSL: error:02001002:system library:fopen:No such file or directory:fopen(’/home/example/ssl.cert’,‘r’) error:2006D080:BIO routines:BIO_new_file:no such file)
2020/12/29 23:58:45 [alert] 12025#12025: *1168 open socket #17 left in connection 93
2020/12/29 23:58:45 [alert] 12025#12025: aborting
나는 SSL 파일이 거기에 있다고 확신하지만 nginx는 다른 것을 생각합니다 ;(
이것이 내가 얻는 결과입니다
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 678/mysqld
tcp 0 0 0.0.0.0:587 0.0.0.0:* LISTEN 1722/master
tcp 0 0 0.0.0.0:110 0.0.0.0:* LISTEN 787/dovecot
tcp 0 0 0.0.0.0:143 0.0.0.0:* LISTEN 787/dovecot
tcp 0 0 0.0.0.0:10000 0.0.0.0:* LISTEN 19353/perl
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 19330/nginx: master
tcp 0 0 0.0.0.0:465 0.0.0.0:* LISTEN 1722/master
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN 15079/systemd-resol
tcp 0 0 207.244.253.107:53 0.0.0.0:* LISTEN 575/named
tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN 575/named
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 630/sshd: /usr/sbin
tcp 0 0 127.0.0.1:11000 0.0.0.0:* LISTEN 1044/lookup-domain-
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 1722/master
tcp 0 0 127.0.0.1:953 0.0.0.0:* LISTEN 575/named
tcp 0 0 207.244.253.107:443 0.0.0.0:* LISTEN 19330/nginx: master
tcp 0 0 0.0.0.0:20000 0.0.0.0:* LISTEN 19398/perl
tcp 0 0 0.0.0.0:993 0.0.0.0:* LISTEN 787/dovecot
tcp 0 0 0.0.0.0:995 0.0.0.0:* LISTEN 787/dovecot
tcp 0 0 127.0.0.1:33060 0.0.0.0:* LISTEN 678/mysqld
tcp 0 0 127.0.0.1:10023 0.0.0.0:* LISTEN 542/postgrey --pidf
tcp6 0 0 :::587 :::* LISTEN 1722/master
tcp6 0 0 :::2222 :::* LISTEN 8361/proftpd: (acce
tcp6 0 0 :::110 :::* LISTEN 787/dovecot
tcp6 0 0 :::143 :::* LISTEN 787/dovecot
tcp6 0 0 :::10000 :::* LISTEN 19353/perl
tcp6 0 0 :::80 :::* LISTEN 19330/nginx: master
tcp6 0 0 :::465 :::* LISTEN 1722/master
tcp6 0 0 :::21 :::* LISTEN 8361/proftpd: (acce
tcp6 0 0 ::1:53 :::* LISTEN 575/named
tcp6 0 0 :::22 :::* LISTEN 630/sshd: /usr/sbin
tcp6 0 0 :::25 :::* LISTEN 1722/master
tcp6 0 0 ::1:953 :::* LISTEN 575/named
tcp6 0 0 :::993 :::* LISTEN 787/dovecot
tcp6 0 0 :::995 :::* LISTEN 787/dovecot
tcp6 0 0 ::1:10023 :::* LISTEN 542/postgrey --pidf
root@server:~#
그리고 네, 파일이 있고 권한이 chmod 600으로 설정되어 있습니다.
감사합니다
답변1
먼저 일부 프로그램은 수신 포트 443입니다. 명령을 사용하여 어떤 프로그램 수신 포트 443을 찾을 수 있습니다 netstat -ltnp
. netstat가 서버를 찾을 수 없으면 net-tools 패키지를 설치하십시오.
두 번째로 nginx는 인증서에 액세스할 수 없습니다. /home/example/ssl.cert
이 인증서가 있는지 확인하세요. 그곳에 머무르면 파일 권한을 확인하세요.