virtual host in ubuntu not work

怎甘沉沦 提交于 2019-12-11 04:42:04

问题


I created a virtual host in /etc/apache2/site-available/mysite.local with this config:

<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>

and in /etc/hosts :

127.0.0.1    localhost
127.0.1.3    mysite.local

but when i go to mysite.local it shows localhost! what's the problem?


回答1:


the problem is according to reloading apache2 service, I must reload apache as a sudoer.

I must use sudo service apache2 reload instead of service apache2 reload.



来源:https://stackoverflow.com/questions/17936026/virtual-host-in-ubuntu-not-work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!