My MPA Journey...
How to find your site on the Internet
When someone tries to reach your site, their request passes through two “switchboards”: DNS and Nginx. DNS tells the browser where your server is. Nginx decides what to serve once the request arrives. There are many alternatives to Nginx and Cloudflare, but we choose them for their simplicity and speed.
1. DNS finds the server
Create a Cloudflare account (free or paid) and move your domain's DNS to Cloudflare by following their instructions. The key step is creating an A record that maps your domain name (e.g., go4webdev.org) to the public IP address of your VPS (e.g., 123.45.67.89). When a user types your domain, DNS simply tells the browser: “This site lives at this IP address." The browser then “knocks on your VPS door”.
2. Nginx finds the MPA site
Nginx runs on your VPS and listens for incoming requests from the browser. When a request arrives, Nginx checks its configuration to decide which site (port) to serve based on the domain name.
To summarize:
Step 1: DNS leads the browser to your VPS
Step 2: Nginx receives the request
Step 3: Nginx forwards it to the port where your Go application is running
Step 4: The user reaches your site