'How do I run a next application on port 80?
I'm trying to run a nextjs app on port 80 on arch linux. I'm getting a permission error even though I'm using sudo. It seems like no other app is using port 80?
This is package.json
:
"scripts": {
"dev": "next dev -p 80",
"build": "next build",
"start": "next start -p 80",
"lint": "next lint"
},
Now when i run sudo npm run dev
I get this error message:
Error: listen EACCES: permission denied 0.0.0.0:80
at Server.setupListenHandle [as _listen2] (node:net:1313:21)
at listenInCluster (node:net:1378:12)
at Server.listen (node:net:1465:7)
at /home/pera/Desktop/projects/agency/frontend/node_modules/next/dist/server/lib/start-server.js:45:16
at new Promise (<anonymous>)
at Object.startServer (/home/pera/Desktop/projects/agency/frontend/node_modules/next/dist/server/lib/start-server.js:19:12)
at nextDev (/home/pera/Desktop/projects/agency/frontend/node_modules/next/dist/cli/next-dev.js:116:23)
at /home/pera/Desktop/projects/agency/frontend/node_modules/next/dist/bin/next:130:34 {
code: 'EACCES',
errno: -13,
syscall: 'listen',
address: '0.0.0.0',
port: 80
}
Now when i run sudo netstat -tulpn
tcp 0 0 127.0.0.1:6463 0.0.0.0:* LISTEN 17894/Discord --typ
tcp 0 0 127.0.0.1:27017 0.0.0.0:* LISTEN 585/mongod
tcp 0 0 127.0.0.1:27060 0.0.0.0:* LISTEN 1350/steam
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN 317/systemd-resolve
tcp 0 0 0.0.0.0:27036 0.0.0.0:* LISTEN 1350/steam
tcp 0 0 127.0.0.1:57343 0.0.0.0:* LISTEN 1350/steam
tcp 0 0 127.0.0.1:9050 0.0.0.0:* LISTEN 438/tor
tcp 0 0 0.0.0.0:5355 0.0.0.0:* LISTEN 317/systemd-resolve
tcp 0 0 127.0.0.54:53 0.0.0.0:* LISTEN 317/systemd-resolve
tcp6 0 0 :::5355 :::* LISTEN 317/systemd-resolve
udp 0 0 0.0.0.0:35486 0.0.0.0:* 17894/Discord --typ
udp 0 0 0.0.0.0:60196 0.0.0.0:* 17894/Discord --typ
udp 0 0 0.0.0.0:44070 0.0.0.0:* 17894/Discord --typ
udp 0 0 127.0.0.54:53 0.0.0.0:* 317/systemd-resolve
udp 0 0 127.0.0.53:53 0.0.0.0:* 317/systemd-resolve
udp 0 0 192.168.0.10:68 0.0.0.0:* 277/systemd-network
udp 0 0 0.0.0.0:5355 0.0.0.0:* 317/systemd-resolve
udp 0 0 0.0.0.0:27036 0.0.0.0:* 1350/steam
udp6 0 0 :::5355 :::* 317/systemd-resolve
This is the output. No app is open on port 80?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|