Centos 6.6 configure vhost in the LAMP environment Apache
1. Open the apache configuration file (httpd. conf), usually in/etc/httpd/conf/httpd. conf
A) Enable LoadModule vhost_alias_module modules/mod_vhost_alias.so (enable the method to delete the '#' before the sentence)
B) In Include conf. d /*. conf write Include conf/extra/httpd-vhosts.conf (this sentence is added to the conf extra folder under the httpd-vhosts.conf file, so this path can be placed in other directories, such as conf. d directory)
C) Set NameVirtualHost *: 80
All the above words can be added with '/' in command mode in vi, such as/vhost. Note that the words are case sensitive.
2. Create an extra directory under the conf directory (use the mkdir extra command to create extra, which is the path used in the above configuration path)
A) create a httpd-vhosts.conf in the extra directory (you can create it using the vi httpd-vhosts.conf)
B) enter the following code:
① UseWww.xx1.comMake the first domain name
<VirtualHost *: 80>
ServerNameWww.xx1.comThe domain name of xx1 is used as an instance.
DocumentRoot "/var/www/html/xx1" here is the folder referred to by the Domain Name
<Directory "/var/www/html/xx1"> the folder specified by the Domain Name
Options Indexes FollowSymLinks ExecCGI Includes
AllowOverride All
Order allow, deny
Allow from all
</Directory>
</VirtualHost>
② UseWww.xx2.comMake the first domain name
<VirtualHost *: 80>
ServerNameWww.xx2.comThe xx2 domain name is used as an instance.
DocumentRoot "/var/www/html/xx2" the folder specified by the Domain Name
<Directory "/var/www/html/xx2"> the folder specified by the Domain Name
Options Indexes FollowSymLinks ExecCGI Includes
AllowOverride All
Order allow, deny
Allow from all
</Directory>
</VirtualHost>
More ......
3. restart the server: (common method: service httpd restart or/etc/init. d/httpd restart)