I have added some fresh Let's Encrypt SSL certificates to my Phoenix app as described in the guide here: https://phoenixframework.readme.io/docs/configuration-for-ssl
When I try to start my server in production mode I get the following error:
23:04:11.573 [info] Running MyAppWeb.Endpoint with Cowboy using http://:::400023:04:11.652 [error] Failed to start Ranch listener MyAppWeb.Endpoint.HTTPS in :ranch_ssl:listen([certfile: '/Users/FJ/projects/elixir/my_app/_build/prod/lib/my_app/priv/ssl/cert.crt', keyfile: '/Users/FJ/projects/elixir/my_app/_build/prod/lib/my_app/priv/ssl/priv.key', port: 443]) for reason :eacces (permission denied)
I don't understand why this happens because I have given the files pretty much all read permissions possible:
ls -la priv/ssl/total 16drwxr-xr-x 4 FJ staff 128 Apr 25 23:09 ./drwxr-xr-x 9 FJ staff 288 Apr 25 23:09 ../-rw-r--r-- 1 FJ staff 1708 Apr 25 23:02 cert.crt-rw-r--r-- 1 FJ staff 1708 Apr 25 23:03 priv.key
I am using MacOS locally but in my production environment (Alpine Linux) I the same error.
Here is the SSL part of production Endpoint config:
https: [port: 443, otp_app: :my_app, keyfile: "priv/ssl/priv.key", certfile: "priv/ssl/cert.crt" ]