Apache2 4 新增虛擬主機

2021-07-30 23:09:14 字數 985 閱讀 5608

apache2.4 與 apache2.2 的虛擬主機配置寫法有所不同

apache2.2的寫法:

80>

servername domain.com

documentroot "/home/www"

directoryindex index.html index.php

"/home/www">

options -indexes +followsymlinks

allowoverride all

order deny,allow

allow from all

directory>

如果在2.4中使用以上寫法就會出現apache ah01630: client denied by server configuration異常。

apache2.4中的寫法為

80>

servername domain.com

documentroot "/home/www"

directoryindex index.html index.php

"/home/www">

options -indexes +followsymlinks

allowoverride all

require all granted

directory>

解決方法,apache2.4中需要將

order

deny,allow

allow

from all

allow

from host ip

改為

require

all granted

require host ip

注:yum安裝的httpd,在/etc/httpd/conf.d/目錄下新增vhosts.conf後重啟即可。

apache2 4 虛擬主機配置

在apache的預設配置下,開啟服務後,開啟http localhost,會顯示 it works!字樣。我們可以配置hosts,sudo vim etc hosts127.0 0.1 localhost 127.0 0.1 urey.com 這時如果訪問也會跳轉到與http localhost 相...

Apache 2 4虛擬主機配置

託管它指的是多個站點的執行一台機器上 例如company1.example.com和company2.example.com 機能夠 基於 ip 即每乙個 ip 乙個 或者 基於名稱 即每乙個 ip 多個 這些 執行在同一物理server上的事實不會明顯的透漏給終於使用者。這是官網解釋。配置apac...

apache2 4配置虛擬主機和ssi

之前在2.2上配置過,最近要公升級到2.4,有些不太一樣的地方。先說開啟ssi,這個跟2.2差不多 1.開啟 loadmodule include module modules mod include.so 2.在directoryindex b index.shtml b index.html 加...