ubuntu 中的虚拟主机不工作 [英] virtual host in ubuntu not work
本文介绍了ubuntu 中的虚拟主机不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用以下配置在 /etc/apache2/site-available/mysite.local
中创建了一个虚拟主机:
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>
在 /etc/hosts
中:
127.0.0.1 localhost
127.0.1.3 mysite.local
但是当我去 mysite.local
它显示 localhost
!有什么问题?
but when i go to mysite.local
it shows localhost
!
what's the problem?
推荐答案
问题是根据重载apache2服务,我必须以sudoer的身份重载apache.
the problem is according to reloading apache2 service, I must reload apache as a sudoer.
我必须使用 sudo service apache2 reload
而不是 service apache2 reload
.
I must use sudo service apache2 reload
instead of service apache2 reload
.
这篇关于ubuntu 中的虚拟主机不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文