在一個Window Server 2008R2系統上使用Apache架設了一個PHP的網站項目
在配置Apache的過程中出現了以下問題

根據上面的提示說是沒有相應的權限,那就在虛擬主機里進行了配置,
httpd-vhosts.conf 中的配置如下
<VirtualHost *:80> ServerAdmin test@test.com DocumentRoot "D:/test.com" ServerName test.com ServerAlias www.test.com ErrorLog "logs/test.com-error.log" CustomLog "logs/test.com-access_log" common <Directory "D:/test.com"> #也可以在http.conf里統一設置,但因為各個虛擬主機的設置不同,因此建議單獨進行設置 AllowOverride All Order allow,deny Allow from all Require all granted </Directory> </VirtualHost>
但配置完成又出現了以下問題
The Apache service named reported the following error:
>>> Invalid command 'Allow', perhaps misspelled or defined by a module not included in the server configuration .

后經過查詢才知道相應的模塊沒有啟用,
在http.conf中的配置,需要啟用以下模塊即可
LoadModule access_compat_module modules/mod_access_compat.so #基於主機的組授權(名稱或IP地址) httpd 2.x兼容的模塊, LoadModule proxy_module modules/mod_proxy.so #apache的代理模塊 LoadModule proxy_http_module modules/mod_proxy_http.so #代理http和https請求 LoadModule vhost_alias_module modules/mod_vhost_alias.so #虛擬主機動態配置 LoadModule authz_host_module modules/mod_authz_host.so #基於主機的組授權 Include conf/extra/httpd-vhosts.conf#啟用虛擬主機配置
重新啟動Apach服務即可
參考: