如何为不同的根目录配置 xampp Web 服务器 [英] how to configuring a xampp web server for different root directory

查看:27
本文介绍了如何为不同的根目录配置 xampp Web 服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Web 目录是您应用程序的所有公共和静态文件的主目录.包括图像、样式表和 JavaScript 文件.这也是前端控制器所在的地方.

所以问题是当我安装和设置 xampp 时,我的网络目录是:

xampp\htdocs

我想设置它:

xampp\htdocs\myproject\web

怎么做?现在,当我在浏览器中输入地址时:http://localhost/
我进入xampp\htdocs目录
我想在浏览器中输入地址:http://localhost/
并进入 xampp\htdocs\myproject\web 目录

解决方案

您可以通过单击(在 xampp 控制面板中)apache/conf/httpd.conf 来更改 Apaches httpd.conf 并调整条目对于 DocumentRoot 和相应的 Directory 条目.对于htdocs"只需 Ctrl+F并将条目更改为您的新路径.

看截图:

<预><代码>## DocumentRoot:您将在其中提供服务的目录# 文件.默认情况下,所有请求都来自此目录,但# 符号链接和别名可用于指向其他位置.#DocumentRoot "C:/xampp/htdocs";<目录C:/xampp/htdocs">

The web directory is the home of all of your application's public and static files. Including images, stylesheets and JavaScript files. It is also where the front controllers live.

So the question is when i install and set up xampp my web directory is:

xampp\htdocs

and I want to set it up for:

xampp\htdocs\myproject\web

How to do it? Now when I type in my browser the address: http://localhost/
I enter xampp\htdocs directory
and I want to type in my browser the address: http://localhost/
and enter xampp\htdocs\myproject\web directory

解决方案

You can change Apaches httpd.conf by clicking (in xampp control panel) apache/conf/httpd.conf and adjust the entries for DocumentRoot and the corresponding Directory entry. Just Ctrl+F for "htdocs" and change the entries to your new path.

See screenshot:

#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "C:/xampp/htdocs"
<Directory "C:/xampp/htdocs">

这篇关于如何为不同的根目录配置 xampp Web 服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆