skip to Main Content

Could someone please look at this configuration file and tell me what I am doing wrong?

Using the curl command: curl -4 https://example.com
I get the following error:
curl: (35) error:1408F10B:SSL routines:ssl3_get_record:wrong version number

When trying to access from Firefox I get: Error code: SSL_ERROR_RX_RECORD_TOO_LONG

The site is accessible via standard http://

server {
      listen 80;

      server_name example.com www.example.com;
    
      root /var/www/example.com/html;
      index index.html;

      location / {
             try_files $uri $uri/ =404;
      }
}

server {
      listen  443 ssl;
      server_name example.com www.example.com;
      ssl_certificate    /etc/ssl/nginx-ssl/bundle.crt;
      ssl_certificate_key    /etc/ssl/nginx-ssl/certificate.key;


      access_log /var/log/nginx/nginx.vhost.access.log;
      error_log /var/log/nginx/nginx.vhost.error.log;
      location / {
      root   /var/www/example.com/html;
      index  index.html;
      }
}

VHOST ACCESS LOG
173.255.234.116 - - [23/Jun/2021:17:38:17 +0000] "x16x03x01x00xEEx01x00x00xEAx03x03>x88xABgxFCxC1AxFC7x01x9Bx07C76xFExF3x14x0BQxAAYV]x8FxB8xF1/xF0x0CxA7G xCCx19xFEixDEx87xF4xF0xF5x1DxD1xxA3CxFBx97)xF0xD9xAD6x99xA3UPx81x8AxC2xA0x09yvx00&xC0/xC00xC0+xC0,xCCxA8xCCxA9xC0x13xC0x09xC0x14xC0" 400 166 "-" "-"
65.154.226.109 - - [23/Jun/2021:17:40:17 +0000] "x16x03x01x02x00x01x00x01xFCx03x03xAAx9F#x06xEFqrxACx8Bx8FxDA x1AxBBxA9Ez4x09xE6x9AxB3kxF8PCxA7)%x00xFBx94 xA7xCCx00=fx9FxCDx8E^xFAbnxCBxC5Zx07#xF5:x8Au^xCBxF1xEC-xDF%xD3?xE8tx00x22x1Ax1Ax13x01x13x02x13x03xC0+xC0/xC0,xC00xCCxA9xCCxA8xC0x13xC0x14x00x9Cx00x9Dx00/x005x00" 400 166 "-" "-"
77.68.112.214 - - [23/Jun/2021:17:41:19 +0000] "x16x03x01x02x00x01x00x01xFCx03x03dx1D_x97x9Azx18xEDl4x1DxA8#xB3xFF" 400 166 "-" "-"
77.68.112.214 - - [23/Jun/2021:17:43:48 +0000] "x16x03x01x02x00x01x00x01xFCx03x03$E" 400 166 "-" "-"

2

Answers


  1. 1st option:
    It’s probably because your double space between listen and 443.

    listen 443 ssl;
    

    2nd option:
    Check your certificate and your key with:

    openssl x509 -in certificate.crt -text -noout
    
    openssl rsa -in privateKey.key -check
    

    Sincerly,

    Login or Signup to reply.
  2. It definitively something with your certificate.

    I’ve tried your configuration with self signed certificate in docker:
    https://i.imgur.com/C5P4KN0.png
    your config running in docker

    I hope it’s readable.

    Try with self signed certificate.

    The command I use to generate self signed certificate:

    openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes
    

    Leo,

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search