1, can be in the Apache http.conf or httpd-vhosts.conf configuration, but recommended in the httpd-vhosts.conf configuration
2. Configuration Example
<pre name= "code" class= "plain" > #如果需要IP来访问服务, you need to configure this
<virtualhost *:80> documentroot/opt/apache/www ServerName 222.212.33.22</virtualhost>
#主域名 <virtualhost *:80> #ServerAdmin webmaster@dummy-host.example.com documentroot/opt/apache/www ServerName www.abc.cn #ErrorLog "Logs/www.abc.cn-error_log" #CustomLog "Logs/www.abc.cn-access_log" common
#DirectoryIndex index.html index.htm index.php
</VirtualHost>
#二级域名
<virtualhost *:80>
#ServerAdmin webmaster@dummy-host.example.com
Documentroot/opt/apache /www/blog
<pre name= "code" class= "plain" > ServerName blog
serveralias
#ErrorLog "Logs/blog.abc.cn-error_log" #CustomLog "Logs/blog.abc.cn-access_log" common
#DirectoryIndex index.html index.htm index.php
</VirtualHost>