When we have finished installing Apache, we build a virtual host.
First start Apache, because my Apache is installed under/application/apache, so through /application/apache/bin/apachectl-k start To launch Apache. You can check it out after you start.
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/7F/BF/wKioL1crQpfS5rOxAAAPH4-te1A367.png "title=" 1.PNG " alt= "Wkiol1crqpfs5roxaaaph4-te1a367.png"/>
Then go to Apache's installation directory and find the hosts ' line.
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/7F/C1/wKiom1crQ9mDe5IfAAAL5yuThOE397.png "title=" 2.PNG " alt= "Wkiom1crq9mde5ifaaal5yuthoe397.png"/>
You can start the virtual machine by removing the # number in front of the include.
Then a directory/var/fisherman is created under/Var, and a line is entered in the HTML file in the directory
[Email protected] conf]# echo ' I am fisherman! My web is http://blog.fisherman.com ' >/var/fisherman/index.html
Since my Linux is installed in the virtual, IP is 192.168.162.128
So add this line to the hosts in this machine 192.168.162.128 blog.fisherman.com
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/7F/C2/wKiom1crSDew5KBcAAALagUZ3bA835.png "title=" 3.PNG " alt= "Wkiom1crsdew5kbcaaalaguz3ba835.png"/>
Then modify the configuration file/application/apache/conf/httpd.conf
Add the following on the last side of the file
<directory "/var/fisherman" >
Options FollowSymLinks
AllowOverride None
Order Allow,deny
Allow from all
</Directory>
Then modify the/application/apache/conf/extra/httpd-vhosts.conf configuration file
Change the default content to
<virtualhost *:80>
ServerAdmin [email protected]
DocumentRoot "/var/fisherman"
ServerName blog.fisherman.com
Serveralias blog.fisherman.com
Errorlog "Logs/fisherman-error_log"
Customlog "Logs/fisherman-access_log" common
</VirtualHost>
After you finish modifying
Enter the command/application/apache/bin/apachectl-t see if there are any errors as shown
Syntax OK means everything is fine.
and start with/application/apache/bin/apachectl graceful.
Finally, enter the domain name in the browser to view
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/7F/C2/wKiom1crSb2xmEPDAAAsPDN8hs0649.png "title=" 4.PNG " alt= "Wkiom1crsb2xmepdaaaspdn8hs0649.png"/>
So that the virtual host is already built.
This article is from the "8932424" blog, please be sure to keep this source http://8942424.blog.51cto.com/8932424/1770569
Apache Domain-based virtual host configuration