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.
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.
<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
Order deny, allow
Allow from all
</Proxy>
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/
</VirtualHost>
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.