I'm setting my nginx to listen to port 8080 here's my config file and it works on when I'm accessing with http e.g http://myweb.com:8080/api/.
server {
listen 8080;
location / {
proxy_pass http://localhost:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_ssl_server_name on;
}
}
However when I try to access it with https on Insomnia it returns SSL connect error.
When I try curl https://myweb.com:8080 --verbose
It returns something like this:
* Trying {myipadress}:8080...
* Connected to myweb.com (ipaddress) port 8080 (#0)
* ALPN: offers h2,http/1.1
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* CAfile: /etc/ssl/certs/ca-certificates.crt
* CApath: none
* OpenSSL/3.0.8: error:0A00010B:SSL routines::wrong version number
* Closing connection 0
curl: (35) OpenSSL/3.0.8: error:0A00010B:SSL routines::wrong version number
I've been configuring for two days and IDK what's wrong, does anybody have similar issue?
This error is due to simply using https:// on a target and port, which is configured for plain http://.
HTTPS and HTTP are different protocols, which need to be configured on different ports and also need different configuration. Specially support for HTTPS needs also the configuration of certificates on the server side. See nginx documentation for how to configure HTTPS.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With