CentOS 配置Apache 基于域名的虚拟主机

在/etc/httpd/conf.d 目录新建www.123admin.com.conf,在其中添加如下代码:

<VirtualHost *:80>
    ServerAdmin webmaster@123admin.com
    DocumentRoot /var/www/html/123admin
    ServerName www.123admin.com
    ServerAlias 123admin.com
    ErrorLog logs/123admin.com-error_log
    CustomLog logs/123admin.com-access_log combined
    DirectoryIndex index.html index.htm index.php

    <Directory "/var/www/html/123admin">
        Options FollowSymLinks
        AllowOverride all
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

然后重启Apache

# service httpd reload