Apache2.4配置虚拟主机

Apache2.4配置虚拟主机

1.修改Apache配置文件httpd.conf,引入虚拟主机配置文件



#Include conf/extra/httpd-vhosts.conf

2.修改httpd-vhosts.conf,添加虚拟主机


# Virtual Hosts
#
#
<Directory "/www">
    Options FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>

<VirtualHost *:80>
    ServerAdmin admin@mogublog.net
    DocumentRoot "/usr/local/apache/htdocs"
    ServerName localhost
    ServerAlias hostname
    ErrorLog "logs/local-error_log"
    CustomLog "logs/local-access_log" common
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin admin@mogublog.net
    DocumentRoot "/www/html"
    ServerName mogublog.net
    ServerAlias www.mogublog.net
    ErrorLog "logs/mogublog-error_log"
    CustomLog "logs/mogublog-access_log" common
</VirtualHost>

发表评论