ubuntu中的虚拟主机不起作用

时间:2013-07-29 23:39:12

标签: ubuntu apache2 virtualhost

我使用此配置在/etc/apache2/site-available/mysite.local中创建了一个虚拟主机:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName mysite.local
    DocumentRoot /var/www/mysite
    <Directory />
            Options FollowSymLinks
            AllowOverride None
    </Directory>
    <Directory /var/www/mysite>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
            AllowOverride None
            Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
            Order allow,deny
            Allow from all
    </Directory>
</VirtualHost>

/etc/hosts

127.0.0.1    localhost
127.0.1.3    mysite.local

但是当我转到mysite.local时,它会显示localhost! 有什么问题?

1 个答案:

答案 0 :(得分:1)

问题是根据重新加载apache2服务,我必须重新加载apache作为sudoer。

我必须使用sudo service apache2 reload代替service apache2 reload