windowsxp sp3+ httpd-2.2.22-win32-x86-openssl-0.9.8t.msi(apache2安裝包)+firefox瀏覽器
其實預設安裝完apache2後,伺服器這個時候已經執行,在瀏覽器中
輸入localhost,伺服器已經正常執行。
這裡主要介紹如何進行埠的修改
在c:\program files\apache software foundation\apache2.2\conf裡面全是有關伺服器的配置目錄,而其中httpd.conf是配置核心
ødocumentroot "c:/program files/apache software foundation/apache2.2/htdocs"
就是預設的html檔案放置路徑
ø訪問許可權配置
options followsymlinks
allowoverride none
order deny,allow
deny from all
ølisten 監聽埠的更改
ø虛擬主機的配置檔案載入
øssl加密認證配置ø等等
將預設的listen 80改為8080,重啟啟動服務
而使用localhost訪問的話就不能正確訪問了
ø將這兩行的注釋去掉
ø注釋掉serveradmin所在行
ø在c:\program files\apache software foundation\apache2.2\conf\extra\ httpd-vhosts.conf檔案中增加如下:
documentroot "c:/www/test/"
servername www.test.com
options followsymlinks
allowoverride none
order allow,deny
allow from all
並且建立c:/www/test/目錄,建立index.html檔案
內容如下:
ø修改c:\windows\system32\drivers\etc\hosts新增127.0.0.1 www.test.com
ø修改伺服器為無**(選項->網路->連線設定)(不然進行解析**dns的時候,會用電信商的dns解析,上一步做的本地的hosts修改無效)
大功告成:訪問www.test.com
在c:\program files\apache software foundation\apache2.2\conf\extra\httpd-vhosts.conf中加入
servername aaa.test.com
serveralias *.test.com
virtualdocumentroot "c:/www/%1"
options followsymlinks
allowoverride none
order allow,deny
allow from all
virtualdocumentroot "c:/www/%1"
就是將二級網域名稱作為引數
c:\program files\apache software foundation\apache2.2\conf\httpd.conf中
options followsymlinks
allowoverride none
order deny,allow
deny from all
修改為options followsymlinks
allowoverride none
order deny,allow
allow from all
並在 c:/www中分別放入aaa 及 bbb目錄,當然了其中的index.html必須寫
c:\windows\system32\drivers\etc\hosts
加入對映:
127.0.0.1 aaa.test.com
127.0.0.1 bbb.test.com
重啟伺服器,分別訪問aaa.test.com bbb.test.com
這樣的話就方便多了,同乙個伺服器開源根據功能劃分相應的二級網域名稱,這樣既功能緊湊又互不影響。
apache2伺服器搭建心得
的配置檔案在 etc apache2 sites alible中,每個檔案對應乙個虛擬站點,但需要在 etc apache2 sites enabled中建立軟鏈結到sites alible中對應的檔案。起初我在sites alible中建立了兩個站點,乙個netaddi.com,乙個test.ne...
Ubuntu搭建Apache2服務
apache http伺服器是世界上使用最廣泛的web伺服器。它提供了許多強大的功能,包括動態載入模組,強大的 支援,以及與其他流行軟體的廣泛整合。在本指南中,我們將討論如何在ubuntu 16.04伺服器上安裝apache web伺服器。apache在ubuntu的預設軟體庫中可用,因此我們將使用...
apache2伺服器的配置步驟
1.在finder中的使用者目錄下新建乙個sites資料夾 如果在 finder中看不到使用者選項,找到finder的偏好設定中的偏欄目錄下勾選一下使用者 小房子圖示的 的那個選項就好了 2.建好的資料夾上會有乙個類似瀏覽器的標誌,然後右鍵設定資料夾的許可權設定為 讀和寫 3.開啟終端輸入以下命令 ...