Error: EACCES: permission denied, open '/opt/bitnami/apache/conf/bitnami/certs/server.key' at Object.openSync (node:fs:596:3) at Object.readFileSync (node:fs:464:35) at file:///home/bitnami/myproj/server/index.js:15:14 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) { errno: -13, syscall: 'open', code: 'EACCES', path: '/opt/bitnami/apache/conf/bitnami/certs/server.key'}
That's the error I get when I try to configure my express server that's deployed on AWS lightsail to use HTTPS. I added the https config like this:
const options = { key: fs.readFileSync('/opt/bitnami/apache/conf/bitnami/certs/server.key'), cert: fs.readFileSync('/opt/bitnami/apache/conf/bitnami/certs/server.crt'),}const server = https.createServer(options, app);server.listen(5000, () => { console.log('HTTPS Server running on port 5000');});
What's the proper way for me to grant permission to my express app to access the https files?