簡體   English   中英

如何更改 WampServer 2.5 上的 www 根目錄

[英]How to Change the www root directory on WampServer 2.5

我需要將 wamp 的默認站點目錄從“c:\\wamp\\www”更改為“d:\\sites”。 現在我在“d:\\sites”中的項目沒有顯示在項目列表中:

在此處輸入圖片說明

我發現了一些過去的答案是這樣一個一個我認為並不適用於WampServer 2.5(無論如何,它並沒有為我工作)。

我還在文檔中找到了這個過程,但對於我需要的東西來說它似乎太復雜了。

對此事的任何幫助將不勝感激。

在較新版本的wamp中,更改httpd.conf中的DocumentRoot並未更改DOCUMENT_ROOT。 即使重新啟動后,它仍然保持為“c:/ wamp64 / www /”。

而是在此文件中設置DocumentRoot:

  c:\\wamp64\\bin\\apache\\apache2.4.18\\conf\\extra\\httpd-vhosts.conf 

要更改localhost目錄,請將這些更改為您的路徑:

  DocumentRoot c:/www <Directory "c:/www/"> 

你想做的事情有點棘手。要做你想做的事情,只需按照以下步驟:

1打開文件C:\\wamp\\bin\\apache\\Apache*.*.*\\conf\\httpd.conf

2查找以下行:

DocumentRoot "c:/wamp/www"
<Directory "c:/wamp/www">

3修改它們以更改根目錄/*In my case i want my "C:\\" drive as root*/所以我這樣做:

DocumentRoot "c:/"
<Directory "c:/">

4現在轉到c:\\wamp\\www找到index.php並復制它,並將有害生物放入新的根目錄/*In my case i want my "C:\\" drive as root*/

5現在打開index.php並找到以下行:

$wampConfFile = '../wampmanager.conf';
$aliasDir = '../alias/';

6現在只需修改它們相對於你的root /*In my case i want my "C:\\" drive as root*/所以我寫道:

$wampConfFile = './wamp/wampmanager.conf';
$aliasDir = './wamp/alias/';

現在它將顯示默認的wamp打開頁面,如圖所示!

  1. 搜索httpd.conf文件

在此輸入圖像描述

  1. 更改DocumentRoot 路徑與您想要的路徑:

在此輸入圖像描述

  1. 搜索httpd-vhosts.conf文件

在此輸入圖像描述

  1. 更改DocumentRoot 路徑與您想要的路徑:

在此輸入圖像描述

  1. 重啟所有服務

在此輸入圖像描述

  1. 去apache httpd

    C:\\ WAMP \\ BIN \\ apache的\\ apache2.2.22 \\的conf

  2. 打開httpd

  3. 在該文件中查找DocumentRoot

  4. 改變路徑

  5. 找到目錄標簽

  6. 目錄標記中的所有內容更改為全部 拒絕

     <Directory /> Options FollowSymLinks AllowOverride None Order allow,deny Allow from all </Directory> 
  7. 保存並退出

  8. 重啟wamp服務

關於 apache 的最好的事情是它會告訴你在嘗試加載配置文件時它在哪里出錯。 WampServer 3.2.0 ,我不得不更改幾個文件。

  1. 在您的虛擬主機文件中更改它
    {installDirectory}\\bin\\apache\\apache2.4.41\\conf\\extra\\httpd-vhosts.conf ServerName localhost DocumentRoot "D:\\Projects\\ApacheWWW" <Directory "D:\\Projects\\ApacheWWW/">

  2. www文件夾中的index.php 中更改它

    $server_dir = "C:/wamp64/";

  3. scripts/config.inc.php第 13 行
    $configurationFile = 'C:/wamp64/wampmanager.conf';

編輯下面文件中的路徑然后重新啟動wamp服務器C:\\ wamp \\ bin \\ apache \\ apache2.4.9 \\ conf \\ httpd.conf

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM