@phenomlab
This is the Nginx conf file
upstream io_nodes {
ip_hash;
server 127.0.0.1:4567;
server 127.0.0.1:4568;
server 127.0.0.1:4569;
}
server {
listen 80;
server_name nodebb.lan;
root /home/nodebb/public_html;
index index.php index.html index.htm;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_redirect off;
# Socket.IO Support
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
location @nodebb {
proxy_pass http://io_nodes;
}
location ~ ^/assets/(.*) {
root /home/nodebb/public_html/;
try_files /build/public/$1 /public/$1 @nodebb;
}
location / {
proxy_pass http://io_nodes;
}
}
This is the current nodebb.service file
[Unit]
Description=NodeBB forum for Node.js.
Documentation=http://nodebb.readthedocs.io/en/latest/
After=system.slice multi-user.target
[Service]
Type=simple
User=nodebb
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=nodebb
Environment=NODE_ENV=production
WorkingDirectory=/home/nodebb/public_html/
# Call with exec to be able to redirect output: http://stackoverflow.com/a/33036589/1827734
ExecStart=/usr/bin/node /home/nodebb/public_html/loader.js
Restart=on-failure
[Install]
Alias=forum
WantedBy=multi-user.target
I started with this code and the above code is from a google search. This code below, I did also try it with the correct path for node.
[Unit]
Description=NodeBB
Documentation=https://docs.nodebb.org
After=system.slice multi-user.target mongod.service
[Service]
Type=forking
User=nodebb
WorkingDirectory=/path/to/nodebb
PIDFile=/path/to/nodebb/pidfile
ExecStart=/usr/bin/env node loader.js --no-silent
Restart=always
[Install]
WantedBy=multi-user.target
The “/usr/bin/env node” is where node is located that I found from using a command.
I also get a 502 Bad Gateway when I start either ./nodebb start or node loader.js.
When I do “sudo systemctl status nodebb” after using “sudo systemctl start nodebb”, I get the following.
○ nodebb.service - NodeBB forum for Node.js.
Loaded: loaded (/etc/systemd/system/nodebb.service; disabled; preset: disabled)
Active: inactive (dead)
Docs: http://nodebb.readthedocs.io/en/latest/
Aug 11 20:53:16 morecowbell.lan systemd[1]: /etc/systemd/system/nodebb.service:10: Standard output type syslog is obsolete, automatically updating to journal. Please update your unit file, and consider removing the setting altogether.
Aug 11 20:53:16 morecowbell.lan systemd[1]: /etc/systemd/system/nodebb.service:11: Standard output type syslog is obsolete, automatically updating to journal. Please update your unit file, and consider removing the setting altogether.
Aug 11 20:53:16 morecowbell.lan systemd[1]: Started NodeBB forum for Node.js..
Aug 11 20:53:16 morecowbell.lan nodebb[2605]: Process "1298" from pidfile already running, exiting
Aug 11 20:53:16 morecowbell.lan systemd[1]: nodebb.service: Deactivated successfully.
Aug 11 20:53:24 morecowbell.lan systemd[1]: /etc/systemd/system/nodebb.service:10: Standard output type syslog is obsolete, automatically updating to journal. Please update your unit file, and consider removing the setting altogether.
Aug 11 20:53:24 morecowbell.lan systemd[1]: /etc/systemd/system/nodebb.service:11: Standard output type syslog is obsolete, automatically updating to journal. Please update your unit file, and consider removing the setting altogether.
Sorry this post is so long and thank you for your help.
Update: I just ran the status for nginx and received the below. So the 192.168.1.10 is my windows PC and the connection was refused. Would I need to add the port to ufw in order for this to work, or is this a different issue.
Aug 11 20:49:54 morecowbell.lan nginx[576]: 2024/08/11 20:49:54 [error] 576#576: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.1.10, server: nodebb.lan, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:4568/", host: "nodebb.lan"
Aug 11 20:49:54 morecowbell.lan nginx[576]: 2024/08/11 20:49:54 [error] 576#576: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.1.10, server: nodebb.lan, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:4569/", host: "nodebb.lan"
Aug 11 20:49:54 morecowbell.lan nginx[576]: 2024/08/11 20:49:54 [error] 576#576: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.1.10, server: nodebb.lan, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:4567/", host: "nodebb.lan"
Aug 11 20:49:55 morecowbell.lan nginx[576]: 2024/08/11 20:49:55 [error] 576#576: *1 no live upstreams while connecting to upstream, client: 192.168.1.10, server: nodebb.lan, request: "GET /favicon.ico HTTP/1.1", upstream: "http://io_nodes/favicon.ico", host: "nodebb.lan", referrer: "http://nodebb.lan/"
Aug 11 20:51:57 morecowbell.lan nginx[577]: 2024/08/11 20:51:57 [error] 577#577: *6 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.1.10, server: nodebb.lan, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:4568/", host: "nodebb.lan"
Aug 11 20:51:57 morecowbell.lan nginx[577]: 2024/08/11 20:51:57 [error] 577#577: *6 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.1.10, server: nodebb.lan, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:4569/", host: "nodebb.lan"
Aug 11 20:51:57 morecowbell.lan nginx[577]: 2024/08/11 20:51:57 [error] 577#577: *6 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.1.10, server: nodebb.lan, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:4567/", host: "nodebb.lan"
Aug 11 20:51:57 morecowbell.lan nginx[577]: 2024/08/11 20:51:57 [error] 577#577: *6 no live upstreams while connecting to upstream, client: 192.168.1.10, server: nodebb.lan, request: "GET /favicon.ico HTTP/1.1", upstream: "http://io_nodes/favicon.ico", host: "nodebb.lan", referrer: "http://nodebb.lan/"
Aug 11 20:51:59 morecowbell.lan nginx[577]: 2024/08/11 20:51:59 [error] 577#577: *6 no live upstreams while connecting to upstream, client: 192.168.1.10, server: nodebb.lan, request: "GET / HTTP/1.1", upstream: "http://io_nodes/", host: "nodebb.lan"
Aug 11 20:51:59 morecowbell.lan nginx[577]: 2024/08/11 20:51:59 [error] 577#577: *6 no live upstreams while connecting to upstream, client: 192.168.1.10, server: nodebb.lan, request: "GET /favicon.ico HTTP/1.1", upstream: "http://io_nodes/favicon.ico", host: "nodebb.lan", referrer: "http://nodebb.lan/"
Update: adding those ports to ufw did not fix it.