Next.js Discord

Discord Forum

Want to set up a NextJS Server strictly for LAN access

Unanswered
Oak apple gall wasp posted this in #help-forum
Open in Discord
Avatar
Oak apple gall waspOP
Hey there! As the title indicates, my goal is to create a NextJS webserver strictly for use within my WiFi/LAN - IP:port is fine but if that can also be simplified that'd be ideal.

I'd love to know more about what would be required in order to make the server accessible to all machines connected to the same network as the server and otherwise be completely inaccessible externally. My intent, just for clarification, is to create a lightweight webserver to do things like view my security cameras or keep a database/inventory of where things are in the house, or control automated sprinklers or other things like that.

What would be my best options?

Thanks for your time and help!

16 Replies

Avatar
davidmytton
I'd set up https://tailscale.com/ on your machines and then set it to listen on the tailscale IP only
Avatar
Oak apple gall waspOP
Okay, I will take a look! Thank you for the link, what is the process in terms of setting it up starting from the local machine and server running on Port 3000, does it require something like Apache or nginx to be configured and running?
Avatar
davidmytton
if it's just running on a server you can run it quite simply with https://nextjs.org/docs/pages/building-your-application/deploying#nodejs-server but you could also containerize it and then expose that over the network
Avatar
Western paper wasp
You can just next start -H 0.0.0.0 -p 3000 and then access as (local-ip):3000 from another device on the same network
Avatar
Oak apple gall waspOP
I will try that! Thank you, going to set up my Raspberry Pi and then test both Solutions
Avatar
davidmytton
What Luke said will work nicely, but only on your local network (which might be exactly what you want). Cool thing about Tailscale is you can install it on any device anywhere (phone, laptop, another server) and it acts like it's all your own private local network
Avatar
Oak apple gall waspOP
It looks like Tailscale requires WIndows 10 or later, a couple of the PCs in the house are still running 7 so that's a bit of a bother
but it does look like a very cool option, I'm going to check that out
since it does enable me to connect to it when I'm out and about and that is a pretty cool feature
Thanks for the suggestion again btw!
I tried next start -H 0.0.0.0 -p 3000 and it starts normally but I don't see it when accessing my rPi4's ip:3000 -

The rPi4 is 192.168.1.99 locally, so I tried 192.168.1.99:3000 and didn't get a response, what could I be missing?
Avatar
davidmytton
could be a firewall blocking it
Avatar
Oak apple gall waspOP
I'll check router settings
how would I most easily bypass the restriction locally eg allowing all 192.168 ranges or similar to access, I have an Asus RT-N12D1 router
Avatar
Oak apple gall waspOP
Okay, got tailscale installed on my devices, where can I see documentation / more info regarding how to configure my next app for tailscale?
Avatar
Oak apple gall waspOP
I've been looking around, I saw a few sources but as yet haven't had the desired outcome. I'd love more info / some guidance regarding how to set up, for reference my rPi is running Manjaro