php www 文件夹和 htdocs 文件夹有什么区别?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21948154/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 04:34:05  来源:igfitidea点击:

What is the difference between www folder and htdocs folder?

phphtmlapacheweb

提问by Bernard

This might be a very basic question. After I installed Apache on my webserver there was created a folder called www. What ever files like html and php files I put there it will be on my website. However, I followed one of the tutorial on youtube and also even my own XAMPP folder has a htdocs folder which is same as www folder. When I put a file inside I can see it if I type its name after localhost. I wondered if there is any difference between these two and I appreciate if someone can explain how we have defined these directories as a container of our files?

这可能是一个非常基本的问题。在我的网络服务器上安装 Apache 后,创建了一个名为 www 的文件夹。我放在那里的任何文件,如 html 和 php 文件,都会在我的网站上。但是,我遵循了 youtube 上的教程之一,甚至我自己的 XAMPP 文件夹也有一个与 www 文件夹相同的 htdocs 文件夹。当我将一个文件放入其中时,如果我在 localhost 之后键入它的名称,我就可以看到它。我想知道这两者之间是否有任何区别,如果有人可以解释我们如何将这些目录定义为文件的容器,我将不胜感激?

采纳答案by jeremyjjbrown

There is no difference. You can configure Apachehttpd to use any folder with appropriate permissions as the root server directory. www is just a conventional directory to use.

没有区别。您可以将 Apachehttpd配置为使用具有适当权限的任何文件夹作为根服务器目录。www 只是要使用的常规目录。

回答by Joseph Collins

Depending on the configuration of the server or the system, you can use the folder where the files of your web application are copied (. Html,. Php, etc.). This folder have different names, but basically is a folder with "permits public access" .

根据服务器或系统的配置,您可以使用复制 Web 应用程序文件的文件夹(.html、.php 等)。这个文件夹有不同的名称,但基本上是一个“允许公共访问”的文件夹。

The folder can be called Linux systems:

该文件夹可以称为Linux系统:

htdocs public_html www

htdocs public_html www

In OSx (Apple), this folder is called "Sites" in Windows Server called "WWWroot".

在 OSx (Apple) 中,此文件夹在 Windows Server 中称为“站点”,称为“WWWroot”。

回答by user2815333

It really all depends on the server configuration. Sometimes hosts will configure www to be document root, sometimes htdocs will be for other applications (this is just an example).

这实际上完全取决于服务器配置。有时主机会将 www 配置为文档根目录,有时 htdocs 将用于其他应用程序(这只是一个示例)。

Either way, both are public and there is no difference as far as standard configuration goes.

无论哪种方式,两者都是公开的,就标准配置而言没有区别。

Like I said though, it really depends on the server configuration.

就像我说的,这真的取决于服务器配置。

All of your configured settings can be found in httpd.conf

所有配置的设置都可以在 httpd.conf 中找到

回答by Dr.Molle

This folder is the so-called Document-Rootof the server, it will be defined via the DocumentRoot-Directive

这个文件夹就是所谓Document-Root的服务器,它会通过DocumentRoot-Directive定义

回答by TRiG

Apache will use whatever folder it's configured to use: you could call it whatever you want. Common conventions include htdocs, httpdocs, and www, but you could also make up your own if you felt like it.

Apache 将使用它配置使用的任何文件夹:您可以随意调用它。常见的约定包括 htdocs、httpdocs 和 www,但如果您愿意,也可以自己编写。