I am trying to run a typesense server in production following the instructions that can be read in the documentation.
My web server is using Plesk, so I created api.example.com, and installed a certificate for this route, then I changed the hosting type to "no hosting" so that this subdomain points to the server and can access typesense with these parameters:
'host' => 'api.example.com', 'port' => '443', 'protocol' => 'https'
I run this docker command for start typesense server:
docker run -p 8108:8108 -v/tmp/data:/data -v/etc/ssl/certs:/certs -v/etc/ssl/private:/private typesense/typesense:0.23.1 --data-dir /data --api-key=xyz --ssl-certificate=/certs/apitypesense.crt --ssl-certificate-key=/certs/apitypesense.key --api-port=443 --enable-cors
but when I try to index data, I receive this error: Fatal error: Uncaught Http\Client\Exception\RequestException: SSL: no alternative certificate subject name matches target host name 'api.example.com'
Note that apitypesense.crt and apitypesense.key are the certs generated by Let's Encrypt in Plesk.
What am I doing wrong? Thank you in advance
Solved,
The problem was with the plesk configuration and not with SSL itself,I was putting the server in "no hosting" mode but that did not allow me to have an SSL certificate, so I put it back in web hosting mode and then, accessing the "Apache and nginx" settings I configured the following additional nginx directive:
location ~ ^/.*{
proxy_pass http://0.0.0.0:8108;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
So now I can access to api.example.com via HTTPS and 443 port.