0

我知道这可能会很长,但请多多包涵。。

我正在使用Xubuntu。我已经从命令行使用 sudo install 安装了 apache 2.something(我认为是 2.4)。在我的文件系统文件夹中有 var 文件夹,其中有 www 文件夹,其中有 hello 文件夹,其中包含我制作的名为 Fitness Tracker的 spring mvc 应用程序。

所以基本上文件夹结构是(FileSystem/www/hello/FitnessTracker)。根文件​​夹是加密的,所以所有文件夹必须首先在某个地方创建,然后通过命令行使用 sudo 全部转移到 www/hello.Fitness Tracker里面有一个名为hellothere.html的 html 页面。

现在,当我从命令行启动 apache 服务器,然后在我的浏览器localhost/hello/FitnessTracker中键入以下 url 时。我得到了 FitnessTracker 的目录结构,这意味着它显示了 html 文件和 FitnessTracker 包含的其他子文件夹。现在我的要求是当在浏览器的地址栏中输入localhost/hello/FitnessTracker时,我必须打开hellothere.html页面。如何才能做到这一点??

PS我已经在我的站点可用目录中放置了一个虚拟主机文件,其中包含以下代码

 <VirtualHost *:80>
 ServerName east.example.org
 DocumentRoot /var/www/hello/FitnessTracker
<Directory /var/www/hello/FitnessTracker>
Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
</Directory>
</VirtualHost>

对于我的代码,localhost/hello/FitnessTrackerhttp://east.example.org/调用是同义词,这意味着它们都返回目录结构。

4

1 回答 1

0

添加DirectoryIndex hellothere.html到您的虚拟主机配置。

同样放置在可用的站点中不足以让您使用虚拟主机,它需要在站点启用时进行符号链接,或者运行sudo a2ensite mysite并运行sudo /etc/init.d/apache2 restart

于 2014-03-12T12:17:45.777 回答