이 문제는 IP 주소를 SSL 지원 호스트 이름으로 라우팅하려고 했던 이전 문제의 확장입니다. 이제 의도한 대로 제대로 작동하지만 Chrome 브라우저에서 보안 자물쇠 아이콘을 볼 수 있습니다. 훌륭하게 작동하지만 Firefox와 EDGE에서는 보안 경고가 표시됩니다.
NGINX 파일의 아래 코드에 추가 입력이 필요합니까?
참고용 원본 문제입니다.-아래 nginx 구성으로 수정되었습니다.
내 도메인 example.com이 있으므로 누군가가 접속하면www.example.com 또는 example.com 요청이 자동으로 다음으로 전달됩니다. https://example.com- 잘 작동해요. 하지만 노드 앱 1.2.3.4의 IP 주소를 사용하면 다음으로 라우팅되지 않습니다.https://example.comSSL이 활성화되어 있습니다. IP 주소를 사용하면 동일한 페이지가 표시되지만 자물쇠 아이콘은 표시되지 않습니다.
그러면 요청을 어떻게 라우팅합니까?https://example.com누군가가 노드 앱의 IP 주소를 입력하면?
내 Node JS APP는 AWS EC2 인스턴스에서 호스팅되며 certbot(LetsEncrpyt)을 사용하여 SSL도 설치했습니다. 이것은 내 nginx 파일입니다.
events {
worker_connections 4096; ## Default: 1024
}
http {
index index.html index.htm;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] $status '
'"$request" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log logs/access.log main;
sendfile on;
tcp_nopush on;
server_names_hash_bucket_size 128; # this seems to be required for some vhosts
# Settings for normal server listening on port 80
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name example.com www.example.com 1.2.3.4;
root /usr/share/nginx/html;
# location / {
# }
# Redirect non-https traffic to https
if ($host = 1.2.3.4){
return 301 https://www.example.com;
}
if ($scheme != "https") {
return 301 https://$host$request_uri;
}
}
# Settings for a TLS enabled server.
server {
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;
server_name example.com www.example.com 1.2.3.4;
root /usr/share/nginx/html;
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
ssl_dhparam "/etc/pki/nginx/dhparams.pem";
if ($host = $server_addr){
return 301 https://www.example.com;
}
location / {
proxy_pass http://127.0.0.1:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
}
이것은 방금 도메인 이름을 가린 Firefox의 스크린샷입니다.
After clicking on the Error code : SSL_ERROR_BAD_CERT_DOMAIN, this is what I get
https://www.example.com/
Unable to communicate securely with peer: requested domain name does not match the server’s certificate.
HTTP Strict Transport Security: false
HTTP Public Key Pinning: false
Certificate chain:
-----BEGIN CERTIFICATE-----
MIIFUTCCBDmgAwIBAgISA152qQHyniTjMg0Mtz+8CCp1MA0GCSqGSIb3DQEBCwUA
MEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD
D7Zz5D2d1ZMoxEjNrcLOCIzip2s/4qSpWua6HF48N4asHa81ZEggYeUtdXkBHSf8
75g2yCVPuu29aQtiA4vNl1gjf7YHsI8IwfkmgFNT924MLSiXJLT9iJfr2uO7mclH
Mm/FXWtrWa/DilLSloBCmeG200mBQW9/xs090OARt4sBnxoEgMcCAwEAAaOCAmIw
ggJeMA4GA1UdDwEB/wQEAwIFoDAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUH
AwIwDAYDVR0TAQH/BAIwADAdBgNVHQ4EFgQUiojLfrHzxUcS4JxPnVMRh7x/XCIw
HwYDVR0jBBgwFoAUqEpqYwR93brm0Tm3pkVl7/Oo7KEwbwYIKwYBBQUHAQEEYzBh
MC4GCCsGAQUFBzABhiJodHRwOi8vb2NzcC5pbnQteDMubGV0c2VuY3J5cHQub3Jn
MC8GCCsGAQUFBzAChiNodHRwOi8vY2VydC5pbnQteDMubGV0c2VuY3J5cHQub3Jn
LzAXBgNVHREEEDAOggxjbGFzc2V0dGUuaW4wTAYDVR0gBEUw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 경우 https가 삭제된 상태로 "Not Secure:https://1.2.3.4"가 표시됩니다.
하지만 크롬에서는 모든 것이 올바르게 작동합니다. 오류나 경고 없음