1 Enter the Conf directory under the Nginx installation path, open the nginx.conf, and the virtual host configuration is as follows
Nginx configuration Segment//
Global zone
worker_processes 1;//There are 1 working sub-processes that can be modified by themselves, but too great for the CPU, which is generally set to CPU number * Number of cores
Event {
// It is common to configure the features of Nginx connection
//such as 1 Word can allow how many connections
worker_connections 1024;//This refers to a child process maximum allowed to connect to 1024 connections
}
http { //This is the primary segment
that configures the HTTP server Server1 {//This is the virtual host segment location
{ //positioning, the special path or file is located again, such as Image directory processing separately}/// such as. PHP alone processing
}
Server2 {
}
}
2 Nginx configuration based on domain name and IP access
2.1 First configuration Nginx as follows
In the domain-based access configuration, z_com is a new folder, it takes the Nginx relative path, as shown below, z_index.html is an HTML file under the Z_com folder
z_index.html Content
2.2 Modify the host file under Windows, add the z.com domain name, as shown
2.3 Domain Access Results http://z.com/
IP Access Result http://192.168.0.100/