
This is a tutorial of how I made my own server with Nginx to serve Node.js applications using a Raspberry Pi on my local network. I did it to have ...
For further actions, you may consider blocking this person and/or reporting abuse
First, this was super helpful so thank you. I'm stuck on the following command:
iptables -A INPUT -p tcp -s localhost --dport 3000 -j ACCEPT
I get the following error:
iptables v1.8.2 (nf_tables): unknown option "--dport"
I tried going to the iptables documentation and they have similar commands like the following so not sure why the first one doesn't work:
iptables -A INPUT -p tcp -s 15.15.15.0/24 --dport 22 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT
iptables-legacy -A INPUT -p tcp -s localhost --dport 3000 -j ACCEPT
iptables-legacy -A INPUT -p tcp --dport 3000 -j DROP
this works for me
If you have a Raspberry Pi running as a web server you could set the IP address statically. It will work even if you have a DHCP server running on the network. If the DHCP server stops you will not be able to get to your web server.
You can use
ufw
package to block incoming traffic at a port, then you won't have to work with iptablesIndeed, but I'm used to doing it from the iptables software itself. 😄
Will this work on a VPS?
Sure, I have a VPS hosting for my personal website and I follow the same logic explained here (without the Raspberry of course). Worked perfectly for me.
I tried to load a ejs page with a public default folder and any of my css file was found, anyone have any tip for this?
You need to add this on line 3
app.use(express.static('public'))
This is how you specify that a folder called "public" will serve static files.
Assuming you have a folder called "css" inside "public"
you can then access like
raspberrypi.local/css/styles.css