【发布时间】:2015-02-15 06:13:30
【问题描述】:
这是我第一次创建虚拟主机并且遇到问题,因为它指向我的 Apache (/var/www/html) 主目录,而不是我想要的目录(/home/juninho/workspace/vhosts-projects/torpedogratis).
下面是我的 /etc/apache2/sites-available/torpedogratis.work.conf 文件:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /home/juninho/workspace/vhosts-projects/torpedogratis.work
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
下面是我的 /etc/hosts 文件:
127.0.0.1 localhost
127.0.0.1 torpedogratis.work
127.0.1.1 Juninho-Dell
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
当我进入http://torpedogratis.work/ 出现的内容是/var/www/html。 为什么会这样?
-
我以为错误在我的 /etc/hosts 文件中,所以我添加了第二行(127.0.0.1 torpedogratis.work),但仍然没有工作。
【问题讨论】:
-
您是否启用了虚拟主机?我认为命令类似于
sudo a2ensite torpedogratis.work.conf+ reboot apache
标签: apache ubuntu virtualhost vps virtual-hosts