Win10 access VM virtual machine CentOS-6.3 system Nginx Service

A compiler environment installed Nginx

Specific Reference: https://blog.csdn.net/LDR1109/article/details/93723708
In addition, there may have been my default virtual machine and external network communication, specifically refer to: https://blog.csdn.net/LDR1109/article/details/103881615
Create a project directory: mkdir -p / mine / serve / project 

to create an access file: vim index.html 
<h1 align = left = "Center" style = "margin-Top: 300px"> Trust Yourself, LDR, you CAN do IT </! h1>

Second, to make the project a separate domain configuration

1. Create a project profile directory: mkdir / Mine / serve / nginx / conf / sites-Enabled 

2, Nginx configuration file changes, the end of the file adding: 
# position in the last row of braces up 
include sites-enabled / * .conf; 

3, create a project configuration file: vim jean.conf 
# add the following 
# ------------------------------- -------------------------------------------------- -------------------- 
Server { 
  the listen 80; 
  server_name www.jean.com; 
  the root / Mine / serve / Project; 
  . * LOCATION ~ \ (JPG | JPEG | GIF | CSS | PNG | JS | ICO | HTML) {$ 
    access_log OFF; 
    Expires max; 
  } 

  LOCATION / { 
        index index.html; 
        autoindex ON; 
        autoindex_exact_size ON; 
        autoindex_localtime ON; 
  }

  {~ /\.ht LOCATION 
    the deny All; 
  } 

  LOCATION ~ \ $ {.sh 
    the deny All; 
  } 
} 
# -------------------------- -------------------------------------------------- ------------------------- 

4, restart Nginx service: / mine / serve / nginx / sbin / nginx -s reload

Three, Linux's host configuration

1, into the / etc directory: cd / etc 

2, edit the hosts file: vim hosts 
# at the end of the file to join 
127.0.0.1 www.jean.com 

3, save and exit: wq

Fourth, the development of the firewall port 80

1, into the / etc / sysconfig directory: CD / etc / sysconfig 

2, document editor iptalbes: iptables Vim 

. 3, addition of 80 ports development codes: -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 ACCEPT -j 

4, restart the firewall: service iptalbes restart (red no obvious error, generally successful start)

Five, Win10 environment configuration

1. Open the txt text editor in administrator mode 

2, open the host file (location: C: \ Windows \ System32 \ the Drivers \ etc) 

3, to join the project DNS: 192.168.18.128 www.jean.com # 192.168.18.128 as virtual machine ip 

4, access, appear as follows, indicating successful!

Concluded

In fact, Win10 virtual machine to access nginx service, the key lies in two points: configure the virtual machine hosts and open port 80, as long as these two pass, no big problem. This study is the knowledge of the main points of the network communications.
Published 59 original articles · won praise 2 · Views 5563

Guess you like

Origin blog.csdn.net/LDR1109/article/details/103881811