I’m trying to point my squarespace domain I purchased to my Public IP.
I am using Ubuntu Server
I have a localhost Next.js app on port 3000. I port forwarded that port and I can access it on a different computer/different network via using my public IP.
Do I need to change my /etc/hosts file to involve the domain name in it attached to my public IP/ipv4
I’m brand new on using domains and networking so your patience is appreciated.
Any advice or points in the right direction would be appreciated.
I pointed to my domain to my public IP via DNS A with @ in the host field.
I’d imagine if I do www.example.com:3000 it’d come to my webserver but it doesn’t.
I thought about trying to set up express.js on my next.js app but not entirely sure if id benefit.
2
Answers
I assume you are pointing it to your home network? Keep in mind that you IP address might change from time to time.
Furthermore you can check how your DNS records are currently set as it can take up to 24 hours for them to update when you make changes. https://who.is/
You should also make sure your next app listens to 0.0.0.0 and not localhost.
If you only need it for testing purposes you can also use ngrok
Let’s say your domain is example.com and your IP is 123.12.34.56, you need to set A record of example.com to 123.12.34.56. Then you need to set up example.com on your server. Following is an example configuration apache webserver.
Once this setup is completed, you can access your web service without a port number.
But if you want to access your web service without the help of a web server, then you need to allow port number 3000 through the firewall.