One server installed Apache, how to bind multiple domain names or websites?
The simplest and most efficient method is as follows:
1. First open the Apache configuration file httpd.conf, in this file,
Find this sentence: "#Include etc/extra/httpd-vhosts.conf"
(The path above will vary slightly depending on the installation path)
Put the front of the melody, that is, the use of virtual host to open the function;
2. Configure the virtual host in the httpd-vhosts.conf, or you can write the configuration directly in the httpd.conf, but
It is not recommended to do so;
3. Open the httpd-vhosts.conf file and find Namevirutalhost *:80, the meaning of this statement is to make this host
IP address and port number;
4. Key VirtualHost configuration, under Namevirutalhost *:80;
NOTE: When Apache accepts a request, it first defaults to the first virtualhost and then matches the other virtual host
Machine, if there is no match, is the first virtualhost function. Therefore, in httpd.conf, the
<dicrectory/> (This is the default configuration for all directories) and <Direcotry/opt/lampp/htdocs> permissions,
is set to deny from all by default.
5. VirtualHost Configuration Example:
<VirtualHost*:80>
ServerName *
DocumentRoot </opt/lampp/htdocs/guest>
<Directory/opt/lampp/htdocs/guest>
Order Deny,allow
Allow from all
</Direcotry>
<VirtualHost/>
Later, add it in turn to
<virtualhost *:80>
ServerName www.myweb1.com
DocumentRoot </opt/lampp/htdocs/myweb1>
<Directory/opt/lampp/htdocs/myweb1>
Order Deny,allow
Allow from all
</Direcotry>
<VirtualHost/>
Bind multiple domain names or websites using Apache settings