phpStudy integrated environment installation (order) Two

Apache virtual host configuration

Virtual host: divide a disk into multiple small spaces, each of which has independent functions: domain name, WWW service, FTP service, etc.

 

There are two main types of web hosting:

 

( 1 ) Virtual host based on domain name: one IP address corresponds to multiple domain names.

 

192.168.3.100   www.sina.com.cn

 

192.168.3.100 www.care-jet.com

 

192.168.3.100 www.xyqeap.com

 

( 2 ) IP- based virtual host: multiple IP addresses, corresponding to multiple domain names ( understand)

 

 

NameVirtualHost command

 

Meaning: NameVirtualHost is one of the main names for configuring domain name-based virtual hosts.

 

Format: NameVirtualHost IP address : port number

 

For example: NameVirtualHost *: 80 // All IP 's 80 -port ( used more)

 

      NameVirtualHost 192.168.3.90:80 // The specified IP and port number can access my host

 

 

The configuration of the virtual host is placed in the vhosts.conf file

<VirtualHost></VirtualHost>命令

Meaning: Detailed configuration content of virtual host

format:

# The first virtual host baidu.com

NameVirtualHost *:80

Include conf/vhosts.conf

<VirtualHost *:80>

#Set the corresponding domain name

ServerName www.baidu.com

# Set the directory corresponding to the domain name space

DocumentRoot "e:\itcast\20140510"

# Set directory permissions

<Directory "e:\itcast\20140510">

#If the homepage file does not exist, then display the folder list

Options Indexes

#Set the prohibited and allowed order

Order deny,allow

#Set the allowed access range

Allow from All

</Directory>

</VirtualHost>

 

Apache alias directory configuration

Meaning: Mount a directory elsewhere to the current domain name as a directory for the current domain name. If you look up this "alias directory" in the space corresponding to the current domain name , it doesn't exist at all. Temporarily borrow other directories.

Format: Alias ​​/ directory alias actual directory address

Example: Alias ​​/ music “e: \ itcast \ 20140510 \ music”  

Note: " / music " must start with " / ", but cannot end with " / ", the alias cannot be a Chinese name

 

Guess you like

Origin www.cnblogs.com/ltl11230/p/12751024.html