Running ubuntu 22.04
I have a test express.js app running and I can connect to it via 192.168.1.6:3000 as local ip and also as (static public IP):3000 but only from devices connected to my WiFi.
As soon as I try to access the (static public IP):3000 with mobile data, I receive an error CONNECTION_REFUSED with an HTTP error code of 102
root@server:~# ss -lntu
Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
udp UNCONN 0 0 127.0.0.53%lo:53 0.0.0.0:*
udp UNCONN 0 0 192.168.1.6%enp1s0:68 0.0.0.0:*
tcp LISTEN 0 4096 127.0.0.53%lo:53 0.0.0.0:*
tcp LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
tcp LISTEN 0 128 [::]:22 [::]:*
I've tried messing with the firewall, enabled, disabled and also adding port 3000 to exceptions list.
root@server:~# ufw status numbered
Status: active
To Action From
-- ------ ----
[ 1] 80/tcp ALLOW IN Anywhere
[ 2] 443 ALLOW IN Anywhere
[ 3] 3000 ALLOW IN Anywhere
[ 4] 3000 ALLOW IN 0.0.0.0
[ 5] 80/tcp (v6) ALLOW IN Anywhere (v6)
[ 6] 443 (v6) ALLOW IN Anywhere (v6)
[ 7] 3000 (v6) ALLOW IN Anywhere (v6)
- I've tried setting up the server to listen to port 3000 but apparently not to much avail.
- I've set up port forwarding from my router settings and that's why my app loads at all with the public static IP address
In addition, regardless if logged in as root or not, I seem to be getting denied permission to run on port 80.
root@server:/home/user/testsite/testapp2# npm run start
> start
> node index.js
node:events:491
throw er; // Unhandled 'error' event
^
Error: listen EACCES: permission denied 0.0.0.0:80
at Server.setupListenHandle [as _listen2] (node:net:1446:21)
at listenInCluster (node:net:1511:12)
at Server.listen (node:net:1599:7)
at Function.listen (/home/user/testsite/node_modules/express/lib/application.js:635:24)
at Object.<anonymous> (/home/user/testsite/testapp2/index.js:9:5)
at Module._compile (node:internal/modules/cjs/loader:1155:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1209:10)
at Module.load (node:internal/modules/cjs/loader:1033:32)
at Function.Module._load (node:internal/modules/cjs/loader:868:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
Emitted 'error' event on Server instance at:
at emitErrorNT (node:net:1490:8)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
code: 'EACCES',
errno: -13,
syscall: 'listen',
address: '0.0.0.0',
port: 80
}
I have no idea what the issue is and 8 hours of googling confirmed I am not asking the right questions. I think maybe the server itself is refusing the WAN connection, but I'm really new to this and I don't know how to troubleshoot properly.
Update: My port forwarding options I've set up so far for testing the webserver
