ServerRoot、DocumentRoot 和 Directory 之间的区别
在使用 Apache 时,我弄乱了路径,而没有备份 httpd.config 文件。
该文件位于 C:\xampp\apache\conf\httpd.config
我想将我的 Web 项目作为虚拟文件夹保留在 D: 驱动器上。这是当前的非工作状态。我该如何解决这个问题或恢复到 xampp 默认值?
ServerRoot "C:\xampp\apache"
DocumentRoot "D:\workspace"
<Directory "D:\workspace\AutionWebSite">
While playing with Apache, I messed up the paths without making a backup httpd.config file.
The file is located at C:\xampp\apache\conf\httpd.config
I want to keep my web project on the D: drive as a virtual folder. This is the current non-working state. How can I fix this or revert to the xampp defaults?
ServerRoot "C:\xampp\apache"
DocumentRoot "D:\workspace"
<Directory "D:\workspace\AutionWebSite">
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
指令用于配置特定目录的设置。但是,您问题中的
命令不完整。<Directory>
directive is used to configure settings for a specific directory. However, the<Directory>
command in your question is not complete.XAMPP 的 DocumentRoot 和 Directory 的默认值为“C:\xampp\htdocs”
The default values for DocumentRoot and Directory for XAMPP is "C:\xampp\htdocs"
我想说,对你来说最简单的方法是检查你的 xampp 版本,备份你的文档根目录(可能是“www”或“htdocs”)、你的配置文件并最终转储你的数据库。现在再次安装相同版本的 xammp,就可以了。
至少第一条规则是使用“配置文件”,之前进行备份。第二条规则是,无论如何都要备份整个配置目录,以防万一。最后一点是,如果你是xammp用户,就意味着你是windows用户,所以你可能没有unixoid服务器管理知识,所以你要开始“玩”apache服务器还有很长的路要走。
唯一认为您应该知道的是,您需要设置方向“AllowOverride All”,如果您使用某些内容管理系统或其他系统,它会带来自己的 .htaccess 文件,则这是必要的。只要您使用 xammp 在 Windows 上工作,而不是在 Linux 或其他 unixoid 操作系统上工作,您就无法理解 apache 等 Web 服务器或 postgresql 等数据库服务器的完整世界以及配置文件的敏感性。
我理解它对于理解整个网络应用程序方面的必要性。成为一名全栈网络程序员,但在此之前,我将来不会更改默认服务器配置,只需检查“AllowOverride All”行即可。希望这会对您有所帮助。
I would say that the most easiest way for you would be to check your xampp version, make a back up of your document root, which is probably "www" or "htdocs", your configuration files and eventually dump your database. Now install the same version of xammp again and there it is.
And at least the first rule is by playing with "config files", make backups before. The second rule is, make a backup of the whole configuration directory anyway, just for the case. And the last one is, if you are a xammp user, means you are a windows user, so you probably don't have unixoid server administration knowledges, so there is a long way for you to starting to "play" with the apache server.
The only think that you should know is, that you need to set the direction "AllowOverride All", which is necessary, if you use some content management system or other systems, which brings there own .htaccess file. So long you work on windows with xammp and not on a linux or other unixoid operating systems, you cannot understand the complete world of web servers like apache or database servers like postgresql and the sensibility of configuration files.
I understand the necessity of it for understanding of whole web applications respect. to be an full stack web programmer, but before that, i wouldn't change in the future the default server configurations, just check the row "AllowOverride All". Hope this will help your.
服务器根目录“/Local”
- 指定 Apache 安装的默认目录层次结构。
文档根目录“/Local/WWW/apache22/data”
- 您将在其中提供文档的目录。
Server Root "/Local"
-specifies the default directory hierarchy for the Apache installation.
Document Root"/Local/WWW/apache22/data"
- the directory out of which you will serve your documents.
在apache配置文件中,
*ServerRoot用于存放服务器相关文件和配置文件。
*DocumentRoot 是您存储网络相关文件的位置。
*目录用于控制服务器在处理来自指定目录的文件请求时的行为。
(大多数情况下,Documentroot和Directory默认包含相似的地址)
谢谢!
In apache configuration file,
*ServerRoot is for store server related files and configuration files.
*DocumentRoot is where you store your web related files.
*Directory is used to control the behavior of the server when handling requests for files from the specified directories.
(In most cases, Documentroot and Directory contain similar address at default)
Thank You!