Nginx Web Server
Nginx is used as a web server.
Nginx can be deployed as a static resource web server to efficiently process static resource requests and separate dynamic and static resources. Files that are not dynamically generated by the server are static resources. Static resources include but not limited to the following:
Category |
Type |
|---|---|
Rendering on the browser |
HTML, CSS, JS |
Image |
JPEG, GIF, PNG |
Audio & video |
FLV, MP4, MP3 |
File |
TXT and any downloaded file |
You can use the server block in the configuration file to define virtual servers, use the root pseudo-instruction to specify the root directory for searching for files, and use the location command to define the matched block. You can also use the index command to define the index file name (index.html by default), as shown in the following example:
server{
listen 80;
server_name localhost;
location/{
root /home/www/html;
index index.html index.htm;
}
location ~ .*\.(gif|jpg|jpeg|png)${
root /home/www/images/;
}
location ~\.(mp3/mp4){
root /home/www/media;
}
}
Table 1 describes the parameters in the example.
Parameter |
Description |
|---|---|
listen 80; |
Specifies the port number. |
server_name localhost; |
Specifies the local host. |
root /home/www/html; |
Specifies the access path. |
index index.html index.htm; |
Specifies the HTML file name. |
Nginx is widely used as the web server because of its excellent web request processing performance in high-concurrency scenarios. The Kunpeng server supports deployment of Nginx web server on physical machines and VMs. The multi-core advantage of Kunpeng processor can further improve the processing performance in high concurrency scenarios. It has great performance advantages in HTTP/HTTPS short and persistent connections.