Apache 的設定 I - 網站根目錄與權限

  • 6986
  • 0
  • 2011-09-08

摘要:Apache 的設定 I - 網站根目錄與權限

一直以來都使用微軟的IIS作為網站伺服器

這次試著使用Apache,基本上這篇文章的內容在網路上都能夠找到

只作為自已學習的記錄而已。

環境:windows server 2003 sp2

step1.停掉iis(其實也可以改port----網站伺服器基本都80port,這樣你就能同時運行iis 與 apache )

開始→系統管理工具→IIS管理員

找到網站,停用他

接下來,

我們來「更改網站根目錄」

開啟apache的httpd.conf檔

(開始→所有程式→Apache HTTP Server 2.2→ Configure Apache Server→Edit the Apache httpd.conf Configuration File)


#
# 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:/Program Files/Apache Software Foundation/Apache2.2"

修改雙引號內的檔案路徑,就可以改變網站根目錄囉。

但是僅僅修改根目錄,我猜你有可能看到下列的畫面。

這是使用者沒有存取目錄權限造成的,我們需要修改設定。


<Directory "C:/Program Files/Apache Software Foundation/Apache2.2">

將紅字的部份也改成你想要的網站根目錄就可以了。

最後再說如何修改首頁,如下


#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>

連副檔名也可以換…呃,其實大家都知道吧