【问题标题】:virtual host in ubuntu not workubuntu中的虚拟主机不起作用
【发布时间】:2013-07-29 22:49:00
【问题描述】:

我用这个配置在/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! 有什么问题?

【问题讨论】:

  • 我也有问题,我认为需要将某些内容更改为主机文件

标签: ubuntu apache2 virtualhost


【解决方案1】:

问题是根据reloading apache2 service,我必须reload apache as a sudoer。

我必须使用sudo service apache2 reload 而不是service apache2 reload

【讨论】:

    猜你喜欢
    • 2016-11-01
    • 2020-01-01
    • 2014-05-30
    • 2015-08-30
    • 2012-06-08
    • 2016-09-29
    • 2018-05-09
    • 1970-01-01
    • 2014-08-02
    相关资源
    最近更新 更多