Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
当我使用apache键入相关url时,如何在浏览器中默认打开html文件?_Apache_Xubuntu - Fatal编程技术网

当我使用apache键入相关url时,如何在浏览器中默认打开html文件?

当我使用apache键入相关url时,如何在浏览器中默认打开html文件?,apache,xubuntu,Apache,Xubuntu,我知道这可能会很长,但请容忍我 我用的是徐邦图。我已经从命令行使用sudo安装了Apache2.something(我认为它是2.4)。在我的文件系统文件夹中有一个var文件夹,其中有一个www文件夹,其中有一个hello文件夹,其中包含一个由我制作的名为Fitness Tracker的spring mvc应用程序 因此,文件夹结构基本上是(FileSystem/www/hello/FitnessTracker)。根文件夹是加密的,因此所有文件夹必须首先在某个地方创建,然后使用sudo通过命令行

我知道这可能会很长,但请容忍我

我用的是徐邦图。我已经从命令行使用sudo安装了Apache2.something(我认为它是2.4)。在我的文件系统文件夹中有一个var文件夹,其中有一个www文件夹,其中有一个hello文件夹,其中包含一个由我制作的名为Fitness Tracker的spring mvc应用程序

因此,文件夹结构基本上是(FileSystem/www/hello/FitnessTracker)。根文件夹是加密的,因此所有文件夹必须首先在某个地方创建,然后使用sudo通过命令行将所有文件夹传输到www/hello.FitnessTracker,其中有一个名为hellother.html的html页面

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

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

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

ServerName east.example.org
DocumentRoot/var/www/hello/FitnessTracker
选项索引跟随符号链接多视图
不允许超限
命令允许,拒绝
通融

这里是我的代码localhost/hello/FitnessTracker/调用的同义词,这意味着它们都返回目录结构。

DirectoryIndex hellother.html
添加到vhost配置中


另外,在可用的站点中放置vhost也不足以让您使用vhost,它需要在站点中启用sym链接,或者运行
sudo a2ensite mysite
sudo/etc/init.d/apache2 restart

请参见:谢谢@RaggaMuffin-420的回答。还有一个问题,如果我的Fitness Tracker应用程序包含另一个子目录,其中有一个jsp文件夹,其中有一个名为hello.jsp的文件。当我键入east.example.org时,必须执行哪些操作才能显示hello.jsp。另外,我已经尝试添加DirectoryIndex hello.jsp,但没有成功。您必须将DocumentRoot设置为该目录,并将DirectoryIndex设置为hello.jsp,然后它将加载。如果你想保留localhost/hello/FitnessTracker,那么你必须为你的localhost创建一个新的virtualhost。哦,它工作了,谢谢@RaggaMuffin-420……我重新启动了我的计算机,它工作了……谢谢你的帮助//:)你可能只需要重新启动apache。。不是你的电脑。