
Testing Your Static Website
Congratulations! You've successfully configured Nginx to serve your static website. Now comes the crucial step: testing to ensure everything is working as expected. This section will guide you through various methods to verify your Nginx setup and confirm that your static files are being delivered flawlessly.
The most straightforward way to test your static website is by accessing it through your web browser. Since we've configured Nginx to listen on port 80 (the default for HTTP), you can simply open your browser and navigate to your server's IP address or domain name. If you're testing on your local machine, you'll typically use localhost or 127.0.0.1.
Let's assume your Nginx server is running on a machine with the IP address 192.168.1.100. In your web browser, you would enter the following address:
http://192.168.1.100If you've configured a domain name, say myawesomewebsite.com, you would use that instead:
http://myawesomewebsite.comWhen you visit this URL, Nginx should serve your index.html file (or whatever you've designated as your default index file) from your configured root directory. If you see your website's homepage, that's a great sign!
Beyond the visual confirmation, it's essential to check the HTTP response status codes. These codes tell you how the server responded to your browser's request. The most common successful code is 200 OK. You can view these status codes using your browser's developer tools. Typically, you can open them by pressing F12 or right-clicking on the page and selecting 'Inspect' or 'Inspect Element', then navigating to the 'Network' tab.