LINCnil / pia-back

Programme développé avec le framework RubyOnRails mettant à disposition une API RESTful à destination des outils PIA et PIA-APP. | Program developped with RubyOnRails providing a RESTful API for the PIA and PIA-APP applications.
GNU General Public License v3.0
156 stars 65 forks source link

How to enable SSL? #224

Closed oleksandr-zh closed 7 months ago

oleksandr-zh commented 1 year ago

Hi all. Thank you for your app and your support. How do I enable HTTPS using an existing certificate? Here is the config nginx pia-back: image When I try to log in via HTTPS, I get the following error (I tried to change the rights to the directory/files - this did not fix the error) /var/log/nginx/error.log 2023/06/26 13:37:51 [error] 638781#638781: *197 directory index of "/var/www/pia-back/" is forbidden, client: 192.168.11.100, server: pia.MYDomain.com, request: "GET / HTTP/1.1", host: "pia.MYDomain.com" image

brunto commented 1 year ago

Hello @oleksandr-zh you must set the root line to /var/www/pia-back/public

oleksandr-zh commented 1 year ago

Hello. Thank @brunto. But I see start page only image

on port 80 I have a fully functional application. I want the same for 443

brunto commented 1 year ago

Your nginx configuration probably needs to be corrected. You can also try Certbot to generate the certificate.

oleksandr-zh commented 1 year ago

When i generate a certificate via Certbot (certbot --nginx -d Mydomain.com) It just adds in /etc/nginx/sites-available/default : ################ listen [::]:443 ssl ipv6only=on; # managed by Certbot listen 443 ssl; # managed by Certbot ssl_certificate /etc/letsencrypt/live/ Mydomain.com/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/ Mydomain.com/privkey.pem; # managed by Certbot include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot ############## The app still doesn't work via 443 port

brunto commented 1 year ago

Ok, so for that kind of problem, it's more related to a Nginx configuration than the PIA tool. But we can do a quick meeting to help you. You can contact us at contact@atnos.com to book it.