虚拟主机总是返回与Apache默认主机在Ubuntu 14.04 [英] VirtualHost always returns default host with Apache on Ubuntu 14.04
问题描述
我试图安装一个虚拟主机除了默认的本地主机
。
每当我试着打电话给我的虚拟主机的http://测试
我得到在 HTTP的目录位于默认的Apache2索引文件://本地主机
。此外阿帕奇返回该页面仍然停用后( a2dissite
),这两个虚拟主机文件的重装阿帕奇(服务的Apache2重装
)
I try to setup a virtual host besides the default localhost
.
Whenever I try to call my virtual host http://test
I get the default Apache2 Index file that sits in the directory of http://localhost
. Furthermore apache returns this page still after disabling (a2dissite
) both VirtualHost files an reloading apache (service apache2 reload
).
什么可能出问题的虚拟主机不工作?
What could go wrong that the virtual host is not working?
配置:
我的目录结构如下:
/var/www/html # Default localhost dir
/var/www/html7index.html # Apache2 default index
/var/www/test # HTML dir for the virtual host
/var/www/test/index.html # My "website"
的内容/ etc / hosts文件
:
127.0.0.1 localhost
127.0.1.1 Laptop
127.0.0.1 test
的/ etc / apache2的/网站可用
名录内容
File 000-default.conf
:
文件 000-default.conf
:
File test.conf
:
文件 test.conf
:
推荐答案
看起来服务的Apache2重装的行为
愚弄了我。请参见以下日志:
Looks like the behaviour of service apache2 reload
fooled me. See the following log:
user@Laptop:/etc/apache2/sites-available$ sudo a2ensite test.conf
Enabling site test.
To activate the new configuration, you need to run:
service apache2 reload
user@Laptop:/etc/apache2/sites-available$ service apache2 reload
* Reloading web server apache2 *
user@Laptop:/etc/apache2/sites-available$
力争达到的http://测试
:不会工作
user@Laptop:/etc/apache2/sites-available$ sudo service apache2 reload
* Reloading web server apache2 *
user@Laptop:/etc/apache2/sites-available$
力争达到的http://测试
工作
所以,找到差异!问题的关键是,我认为这将已经在第一时间正确地重新加载。有在日志文件中没有条目无论是。与调用它的 须藤
帮助。这是一个错误?
So, find the difference! The point is that I thought it would've reloaded correctly in the first place. There are no entries in the log files either. Calling it with sudo
helped. Is this a bug?
这篇关于虚拟主机总是返回与Apache默认主机在Ubuntu 14.04的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!