Trying to turn on HTTPS. I have attempted a few guides at doing this and have created the PEM files.
I then modify settings.js file and have tried to use option 1 and option 2 but nothing seems to work.
The one difference I have is that I have 2 node-red installed locally. I am also using a daemond to start them up. For example:
ExecStart=/usr/bin/node /home/administrator/nr1/node_modules/node-red/red.js -s /home/administrator/nr1/node_modules/node-red/settings.js
My settings.js looks like this:
/** Option 1: static object */
https: {
key: require("fs").readFileSync('/certs/node-key.pem'),
cert: require("fs").readFileSync('/certs/node-cert.pem')
},
the "certs" folder is in /home/administrator/nr1/certs/. I have verified that I have the 2 files node-key.pem and node-cert.pem inside that folder.
Any idea as to what I have done wrong?
systemctl status nr1 (the name of my daemon) shows:
nr1.service - Node-Red for NR1
Loaded: loaded (/etc/systemd/system/nr1.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Thu 2022-12-08 19:03:04 UTC; 13s ago
Docs: http://nodered.org/docs
` Process: 1228 ExecStart=/usr/bin/node /home/administrator/nr1/node_modules/node-red/red.js -s /home/administrator/nr1/node_modules/node-red/settings.js (code=exited, status=0/SUCCESS)
Main PID: 1228 (code=exited, status=0/SUCCESS)
CPU: 1.310s
Dec 08 19:03:04 nodered node[1228]: at Module.require (internal/modules/cjs/loader.js:887:19)
Dec 08 19:03:04 nodered node[1228]: at require (internal/modules/cjs/helpers.js:74:18)
Dec 08 19:03:04 nodered node[1228]: at Object.<anonymous> (/home/administrator/nr1/node_modules/node-red/red.js:140:20) {
Dec 08 19:03:04 nodered node[1228]: errno: -2,
Dec 08 19:03:04 nodered node[1228]: syscall: 'open',
Dec 08 19:03:04 nodered node[1228]: code: 'ENOENT',
Dec 08 19:03:04 nodered node[1228]: path: '/certs/node-key.pem'
Dec 08 19:03:04 nodered node[1228]: }
Dec 08 19:03:04 nodered systemd[1]: nr1.service: Deactivated successfully.
Dec 08 19:03:04 nodered systemd[1]: nr1.service: Consumed 1.310s CPU time.
Really new to these things so any ideas are appreciated.