apache - NGINX HTTPS Server - SSL_ERROR_BAD_CERT_DOMAIN -


i have nginx server running on ec2 instance, , i'm implementing https on server. generated ssl certificate on site , put on server. restarted server , still runs right, got 2 problems (my domain hbesco.com.br, , that's common name put certificate request):

it doesn't enter https default, goes http. also, if force https://hbesco.com.br, goes ok. https://www.hbesco.com.br, gives me following error:

unable communicate securely peer: requested domain name not match server’s certificate. http strict transport security: false http public key pinning: false certificate chain: -----begin certificate----- (...)

my nginx sites-available/default set bellow:

server {        listen 443 default_server;         ssl on;        ssl_certificate /usr/share/nginx/certificado-2048/certificadossl.crt;        ssl_certificate_key /usr/share/nginx/certificado-2048/certificadossl.key;          server_name hbesco.com.br;         passenger_enabled on;         rails_env    production;         root         /home/ubuntu/hybrazil/current/public;          # redirect server error pages static page /50x.html         error_page   500 502 503 504  /50x.html;         location = /50x.html {             root   html;         } }  server {         listen 80;          server_name hbesco.com.br;         passenger_enabled on;         rails_env    production;         root         /home/ubuntu/hybrazil/current/public;          # redirect server error pages static page /50x.html         error_page   500 502 503 504  /50x.html;         location = /50x.html {             root   html;         } } 

any ideas on why when type "hbesco.com.br" goes http first, , why when has www before, gives me error?

it doesn't enter https default, goes http

you need add rewrite rule force visitors redirected http https:

server {         listen 80;         server_name hbesco.com.br;         rewrite     ^   https://$server_name$request_uri? permanent; } 

unable communicate securely peer: requested domain name not match server’s certificate.

this means hbesco.com.br listed in certificate. can check ssl checker.


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -