2011-11-14 21 views
7

我希望能夠使用C以外的別名如何:\ XAMPP-範圍,因爲在XAMPP的dev的機器設置別名

alias /opt "C:\opt" 

有在XAMPP一些設置,我不能牽制,試圖改變用戶,添加等,其中沒有任何工作,這是一個純粹的開發環境,所以這裏最親吻的解決方案是什麼?

問候, //牛逼

回答

11

你需要有兩個條目它,別名和目錄。您的/opt/lampp/etc/extra/httpd-xampp.conf(source)中應該有一個條目,看起來像下面的代碼塊之一。一些配置選項已經改變,更多信息可以在文檔中找到Upgrading to 2.4 from 2.2

Apache 2.2的配置:

Alias /opt/ "C:/opt/" 
<Directory "C:/opt"> 
     Options Indexes FollowSymLinks MultiViews ExecCGI 
     AllowOverride All 
     Order allow,deny 
     Allow from all 
</Directory> 

的Apache 2.4配置:

Alias /opt/ "C:/opt/" 
<Directory "C:/opt"> 
     Options Indexes FollowSymLinks MultiViews ExecCGI 
     AllowOverride All 
     Require all granted 
</Directory> 

別名段定義你的虛擬目錄和實際目錄。在此示例中,website.com/opt/(或localhost/opt)將指向硬盤驅動器上的C:/ opt。

目錄部分定義了apache應該如何處理從這個位置提供的內容,它將像任何其他目錄條目一樣工作,所以從根條目複製一個並使它們相似可能是一個好主意。

這還需要啓用mod_alias,請檢查httpd-xampp.conf並確保其條目未被註釋掉。對conf文件進行任何更改後,您將需要重新啓動apache以使更改生效。

+0

這個鏈接已經死了恐怕 – pluke

+1

我把它更新爲全部文本,看起來類似於下面。我還在Xampp論壇上找到了配置文件的位置,並添加了一個鏈接以供參考。 – Melikoth

+0

這花了我很長時間,但缺少一條線。正確的解決方案應該包括「要求所有授權」才能工作。 – Veehmot

0

最後,易如:

Alias /opt "C:/opt" 
<Directory "C:/opt"> 
    Options +Indexes 
    AllowOverride None 
    Order allow,deny 
    Allow from all 
</Directory> 
+0

你在哪裏存儲這個條目?在Apache中它在 Apache24/conf/extra/alias.conf 但是這個文件在xampp中不存在 – pluke

2

你會想要做的第一件事是添加一個別名目錄到您的XAMPP安裝:

C:\xampp\apache\conf\alias 

接下來,你會需要更改你的Apache配置文件。你可以找到它下

C:\xampp\apache\conf\httpd.conf 

一旦你打開httpd.conf中,添加以下到結束並保存。現在

Include "conf/alias/*" 

,對於每一個別名要創建你需要創建一個文件是這樣的:

<directory "c:\users\foo\programming\dev"> 
    # 
    # Possible values for the Options directive are "None", "All", 
    # or any combination of: 
    # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews 
    # 
    # Note that "MultiViews" must be named *explicitly* --- "Options All" 
    # doesn't give it to you. 
    # 
    # The Options directive is both complicated and important. Please see 
    # http://httpd.apache.org/docs/2.2/mod/core.html#options 
    # for more information. 
    # 
    Options Indexes FollowSymLinks Includes ExecCGI 

    # 
    # AllowOverride controls what directives may be placed in .htaccess files. 
    # It can be "All", "None", or any combination of the keywords: 
    # Options FileInfo AuthConfig Limit 
    # 
    AllowOverride All 

    # 
    # Controls who can get stuff from this server. 
    #  Order allow,deny 
    Allow from all 
</Directory> 

Alias /dev "C:\users\foo\programming\dev" 

在這個例子中,別名叫做「開發」並將其指向「 C:\ users \ foo \ programming \ dev「

最後,您需要重新啓動Apache服務器,就是這樣。

+2

儘管這個鏈接可能回答這個問題,但最好在這裏包含答案的基本部分並提供鏈接供參考。如果鏈接頁面更改,則僅鏈接答案可能會失效。 – djv

+0

好點。我會去做。謝謝 –