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) Remove the previous #, 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 (This is the default configuration for all directories) and 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,allowallow from All</direcotry><virtualhost/>
Later, add it in turn to <virtualhost *:80>servername Www.myweb1.comDocumentRoot </opt/lampp/htdocs/myweb1><directory/opt/ Lampp/htdocs/myweb1>order Deny,allowallow from All</direcotry><virtualhost/>
Set the default document order: In your Apache, there's a conf folder with a httpd.conf I found this part in there. <directory/> Options followsymlinks directoryindex index.php index.html allowoverride All Order Deny,allow
This order is index.php and index.html. You can follow the order of the documents required by your website, pay attention to backup, change the wrong Apache will not start! |