Skip to content

Commit 797bf15

Browse files
authored
Editing Nginx 022-web-servers-nginx.md (#2330)
* replace most passive voice with active * Use Nginx (product name) as consistently capitalized * other minor corrections
1 parent dbd2430 commit 797bf15

File tree

1 file changed

+42
-42
lines changed

1 file changed

+42
-42
lines changed

docs/books/web_services/022-web-servers-nginx.md

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -25,42 +25,42 @@ In this chapter, you will learn about the web server Nginx.
2525

2626
### Generalities
2727

28-
**Nginx** is a **free HTTP web server under BSD license**. It was first developed in Russia in 2002 by Igor Sysoev. In addition to the standard features of a web server, Nginx provides a **reverse proxy** for the **HTTP** protocol, as well as a proxy for the **POP** and **IMAP** messaging protocols.
28+
**Nginx** is a **free HTTP web server under BSD license**. It was first developed in Russia in 2002 by Igor Sysoev. In addition to the standard features of a web server, Nginx provides a **reverse proxy** for the **HTTP** protocol, and a proxy for the **POP** and **IMAP** messaging protocols.
2929

30-
The development of the nginx server is a response to the **C10K** problem: supporting 10,000 concurrent connections (common on the modern web) is a real challenge for web servers.
30+
The development of the Nginx server is a response to the **C10K** problem. That is, supporting ten thousand concurrent connections (common on the modern web). It is a real challenge for web servers.
3131

3232
Commercial support is available from Nginx Inc.
3333

3434
The server's internal architecture enables **very high performance** with **low memory consumption** compared to the Apache web server in particular.
3535

36-
Modules complementing the basic functions of the nginx kernel are compile-time bound: they cannot be activated/deactivated on the fly.
36+
Modules complementing the basic functions of the Nginx kernel are compile-time bound. Meaning activation or deactivation cannot happen dynamically.
3737

38-
Server processes are controlled by a master process, making it possible to **modify configuration or update software without stopping service**.
38+
Control of server processes is with a master process, making it possible to **modify configuration or update software without stopping the service**.
3939

4040
Nginx has a significant market share of 28% on the busiest sites on the market, just behind Apache (41%).
4141

4242
#### Features
4343

4444
Nginx offers the following basic functions:
4545

46-
* Hosting of static web pages;
47-
* Automatic index page generation;
48-
* Accelerated reverse proxy with cache;
49-
* Load balancing;
50-
* Fault tolerance;
51-
* Cached support for FastCGI, uWSGI, SCGI and memcached cache server;
52-
* Various filters for gzip, xslt, ssi, image transformation, ...
53-
* Support for SSL/TLS and SNI;
54-
* HTTP/2 support.
46+
* Hosting of static web pages
47+
* Automatic index page generation
48+
* Accelerated reverse proxy with cache
49+
* Load balancing
50+
* Fault tolerance
51+
* Cached support for FastCGI, uWSGI, SCGI and memcached cache server
52+
* Various filters for gzip, xslt, ssi, image transformation, and more
53+
* Support for SSL/TLS and SNI
54+
* HTTP/2 support
5555

5656
Other features:
5757

58-
* Hosting by name or IP address;
59-
* Keepalive management of client connections;
60-
* Log management: syslog, rotation, buffer;
61-
* URI rewriting;
62-
* Access control: by IP, password, etc.
63-
* FLV and MP4 streaming.
58+
* Hosting by name or IP address
59+
* Keepalive management of client connections
60+
* Log management: syslog, rotation, buffer
61+
* URI rewriting
62+
* Access control: by IP, password, and more
63+
* FLV and MP4 streaming
6464

6565
### Installation
6666

@@ -73,15 +73,15 @@ sudo systemctl enable nginx --now
7373

7474
### Configuration
7575

76-
Nginx configuration is located in `/etc/nginx`:
76+
The location of the Nginx configuration is in `/etc/nginx/nginx.conf`.
7777

78-
The `/etc/nginx/nginx.conf` file: global server configuration file. Settings affect the entire server.
78+
This configuration file is a global server configuration file. Settings affect the entire server.
7979

8080
!!! NOTE
8181

8282
The .htaccess file functionality known to Apache administrators does not exist in nginx!
8383

84-
The `nginx.conf` file, stripped of all comments, is provided below for your information:
84+
Provided here is the `nginx.conf` file, stripped of all comments, for your information:
8585

8686
```bash
8787
user nginx;
@@ -126,12 +126,12 @@ Default configuration guidelines:
126126
| Directive | Description |
127127
|-----------------------------|-------------|
128128
| `user` | Defines the process owner `user` and `group`. If the group is not specified, the group with the same name as the user is used. |
129-
| `worker_processes` | Defines the number of processes. The optimum value depends on many factors, such as the number of CPU cores, hard disk specifications, etc. In case of doubt, the nginx documentation suggests a starting value equivalent to the number of CPU cores available (the auto value will try to determine this). |
129+
| `worker_processes` | Defines the number of processes. The optimum value depends on many factors, such as the number of CPU cores, hard disk specifications, etc. In case of doubt, the Nginx documentation suggests a starting value equivalent to the number of CPU cores available (the auto value will try to determine this). |
130130
| `pid` | Defines a file to store the pid value. |
131131
| `worker_connections` | Sets the maximum number of simultaneous connections a worker process can open (to the client and to mandated servers). |
132132
| `tcp_nopush` | `tcp_nopush` is inseparable from the sendfile option. It is used to optimize the quantity of information sent at a single time. Packets are only sent when they have reached their maximum size. |
133133
| `tcp_nodelay` | Activating `tcp_nodelay` forces data contained in the socket to be sent immediately, regardless of packet size, which is the opposite of what `tcp_nopush` does. |
134-
| `sendfile` | Optimize the sending of static files (this option is not required for a proxy-inverse configuration). If sendfile is enabled, nginx ensures that all packets are completed before they are sent to the client (thanks to `tcp_nopush`). When the last packet arrives, nginx disables `tcp_nopush` and forces data to be sent using `tcp_nodelay`. |
134+
| `sendfile` | Optimize the sending of static files (this option is not required for a proxy-inverse configuration). If sendfile is enabled, Nginx ensures that all packets are completed before they are sent to the client (thanks to `tcp_nopush`). When the last packet arrives, Nginx disables `tcp_nopush` and forces data to be sent using `tcp_nodelay`. |
135135
| `keepalive_timeout` | maximum time before closing an inactive connection. |
136136
| `types_hash_max_size` | Nginx maintains hash tables containing static information. Set the maximum size of the hash table. |
137137
| `include` | Include another file or files that match the template provided in the configuration. |
@@ -143,7 +143,7 @@ Default configuration guidelines:
143143
| `gzip` | The ngx_http_gzip_module is a filter that compresses data transmitted in gzip format. |
144144
| `gzip_disable` | Disable gzip based on a regular expression. |
145145

146-
The nginx configuration is structured as follows:
146+
The structure of the Nginx configuration is:
147147

148148
```text
149149
# global directives
@@ -157,14 +157,14 @@ http {
157157
158158
# Configure the first server listening on port 80
159159
server {
160-
listen 80 default_server;
161-
listen [::]:80 default_server;
162-
root /var/www/html;
163-
index index.html index.htm;
164-
server_name _;
165-
location / {
166-
try_files $uri $uri/ =404;
167-
}
160+
listen 80 default_server;
161+
listen [::]:80 default_server;
162+
root /var/www/html;
163+
index index.html index.htm;
164+
server_name _;
165+
location / {
166+
try_files $uri $uri/ =404;
167+
}
168168
}
169169
}
170170
@@ -191,9 +191,9 @@ mail {
191191

192192
### https configuration
193193

194-
To configure an https service, you need to add a server block, or modify an existing server block (a server block can listen on both port 443 and port 80).
194+
To configure an HTTPS service, you need to add a server block, or modify an existing server block. A server block can listen on both port 443 and port 80.
195195

196-
This block can, for example, be added to the new `/etc/nginx/conf.d/default_https.conf` file:
196+
You can add this block, for example, to the new `/etc/nginx/conf.d/default_https.conf` file:
197197

198198
```bash
199199
server {
@@ -210,7 +210,7 @@ server {
210210
}
211211
```
212212

213-
or the default server can be modified to support https:
213+
or you can modify the default server to support HTTPS:
214214

215215
```bash
216216
server {
@@ -226,9 +226,9 @@ server {
226226

227227
### Log management
228228

229-
The `error_log` directive is used to configure error logs.
229+
You can configure the `error_log` directive for error logs.
230230

231-
Syntax of the error_log directive:
231+
Syntax of the `error_log` directive:
232232

233233
```bash
234234
error_log file [level];
@@ -238,15 +238,15 @@ The first parameter defines a file to receive error logs.
238238

239239
The second parameter determines the log level: debug, info, notice, warn, error, crit, alert or emerg (see syslog chapter of our admin guide).
240240

241-
Logs can be sent to syslog using the “syslog:” prefix.
241+
The function of sending logs to syslog is with the “syslog:” prefix.
242242

243243
```bash
244244
access_log syslog:server=192.168.1.100:5514,tag=nginx debug;
245245
```
246246

247247
### Nginx as a reverse proxy
248248

249-
Reverse proxy functionality is provided by the `ngx_http_upstream_module`. It lets you define groups of servers which are then called by the `proxy_pass` or `fastcgi_pass` directives, `memcached_pass`, etc.
249+
Reverse proxy functionality is with the `ngx_http_upstream_module`. It lets you define groups of servers which are then called by the `proxy_pass` or `fastcgi_pass` directives, `memcached_pass`, and more.
250250

251251
Example of a basic configuration, which distributes the load 2/3 to the first server and 1/3 to the second application server:
252252

@@ -263,7 +263,7 @@ Example of a basic configuration, which distributes the load 2/3 to the first se
263263
}
264264
```
265265

266-
Servers can be declared as backups:
266+
You can declare servers as backups:
267267

268268
```bash
269269
upstream frontservers {
@@ -273,7 +273,7 @@ Servers can be declared as backups:
273273
}
274274
```
275275

276-
The server directive accepts a number of arguments:
276+
The server directive accepts many arguments:
277277

278278
* `max_fails=numberofattempts`: sets the number of connection attempts that must fail during the time period defined by the `fail_timeout` parameter for the server to be considered unavailable. Default value is 1, 0 disables functionality.
279279
* `fail_timeout=time`: sets the time during which a defined number of connections will cause the server to be unavailable, and sets the period of time during which the server will be considered unavailable. The default value is 10 seconds.

0 commit comments

Comments
 (0)