(3) Nginx Virtual host Configuration

Source: Internet
Author: User
Tags html page

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/


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.