Apache 2.4.x 對比 2.2.x 不少配置都不同。html
虛擬主機配置訪問權限配置不一樣:ide
按照2.2.x的配置方法,會報下面的錯誤:
AH01630: client denied by server configuration: /var/www/html/login.html
先給你們看看Apache-2.2.x配置虛擬機的內容:
NameVirtualHost 172.24.0.4:9090ui
<VirtualHost *:9090>
DocumentRoot /var/www/html
ServerName zebra.zqpay.com
<Directory "/var/www/html">
IndexOptions Charset=GB2312
Options -Indexes +FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
DirectoryIndex login.html
</Directory>
ErrorLog logs/zebra-error_log
CustomLog logs/zebra-access_log common
</VirtualHost>spa
Apache 2.4.x虛擬主機的配置以下:server
<VirtualHost *:9090>
DocumentRoot /var/www/html
ServerName zebra.zqpay.com
<Directory "/var/www/html">
IndexOptions Charset=GB2312
Options -Indexes +FollowSymLinks
AllowOverride All
Require all granted
DirectoryIndex login.html
</Directory>
ErrorLog logs/zebra-error_log
CustomLog logs/zebra-access_log common
</VirtualHost>
總結:
能夠看到Apache-2.4.x把NameVirtualHost給取消了,不須要再配置NameVirtualHost。
刪除了 Order deny,allow 和 Order allow,deny
把 Deny from all 替換成了 Require all denied
把Allow from all 替換成了 Require all granted
而後還把 Allow from 192.168.10.21 這樣的語句給替換成了 Require host 192.168.10.21htm