Getting Started with Nginx: From a Browser Request to a Website
🎯 Introduction
You have written some study notes and can open the file by double-clicking it. How can someone else read it at a URL? If the page also needs data from a backend, what forwards those requests? This course starts with these two questions and walks you through publishing a study notes site with Nginx. No prior knowledge of Nginx, Linux administration, or backend frameworks is required.
🧱 What Happens Behind a URL
The browser initiates a visit and is called the client. The software that receives requests and serves content is a server program. The computer running that software is also often called a server; the context tells you which meaning applies.
For example, open http://127.0.0.1:8080/notes:
| Part | Meaning |
|---|---|
http | The communication protocol: rules for sending and interpreting messages |
127.0.0.1 | The local address, referring to the computer running the browser |
8080 | The port number, which identifies the program receiving requests on that computer |
/notes | The path, which tells the program what content you want |
The message sent by the browser is a request; the server's reply is a response. An HTTP response includes a status code, headers, and a body. A status code such as 200 indicates success. Headers describe details such as the content type, while the body contains the page text or image data. Later, you will inspect these parts with commands.
People often use domain names, such as example.com, instead of numerical addresses that are hard to remember. DNS looks up network addresses for domain names. A domain name and a page path are separate things.
✨ What Nginx Does
Nginx (pronounced “engine x”) receives network requests. This course uses the free, open source version and focuses on three capabilities:
- Serving static files: Reading existing HTML pages, CSS files, or images and sending them to the browser.
- Reverse proxying: Receiving requests on behalf of a backend application, forwarding them to it, and returning its responses to the browser.
- Load balancing: Distributing requests among multiple backend instances according to a set of rules.
Static content exists in files ahead of time; dynamic content is generated by a program in response to a request. Nginx can serve frontend build output, but it does not execute Node.js business logic. Configuration alone cannot implement user login or store notes.
The proxy exercises use additional Nginx sites as mock backends. They return fixed content so you can focus on the request flow. In a real deployment, replace their addresses with those of your applications.
🧭 How to Follow This Course
| Step | Topics | Result |
|---|---|---|
| 1 | Installation, configuration, startup, and reloading | View your first page locally |
| 2 | Static files, path matching, frontend routing, caching, and compression | Publish the study notes site correctly |
| 3 | Reverse proxying, forwarded information, and load balancing | Access pages and APIs through one entry point |
| 4 | Logs, request limits, and HTTPS | Diagnose problems with logs and verify request limits and HTTPS |
The main exercises use Bash on Ubuntu 24.04 LTS, with the distribution's Nginx 1.24 series packages and security updates. The example directives are supported by that version. Mac users can use an Ubuntu virtual machine; Windows users can use an existing Ubuntu WSL environment. Run all subsequent commands inside Ubuntu. If you do not have an Ubuntu environment, prepare a machine dedicated to these exercises first.
Keyboard instructions use Mac key names first. Ctrl in terminal prompts corresponds to the Mac keyboard's ⌃ Control key.
The course assumes only that you can open a terminal and edit text. Commands are explained when first introduced. The examples reuse one exercise directory, so follow the articles in order.
❓ Questions and Answers
Q1: Does installing Nginx automatically put my website on the internet?
No. Running the program, making the machine reachable, pointing the domain to the right address, and opening the port are separate requirements. The first half of the course listens only on the local machine; public deployment comes at the end.
Q2: Do I need to learn how to write web pages first?
No. The course provides an HTML file you can save directly. For now, understand that it is a text file sent to the browser.
🧪 Exercise
Break down http://127.0.0.1:9001/notes?type=public into its protocol, address, port, path, and query parameters.
Check your answer: the protocol is http, the address is 127.0.0.1, the port is 9001, and the path is /notes. The type=public after the question mark is a query parameter that supplies additional request criteria; it is not part of the path.
🎉 Understanding where a browser request goes is your first step toward learning Nginx!
Deployment and Troubleshooting
Configure ports and a reverse proxy, verify connections and application behavior, and learn how to broadcast across multiple instances.
Installation and Setup
Install Nginx on Ubuntu and create separate content and configuration directories to keep the system service distinct from your exercise instance.
