ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
简单对比,2.2.x常见配置格式如下 ~~~ <VirtualHost *:80> DocumentRoot "D:/www/Apache24/htdocs" ServerName localhost <Directory D:/www/Apache24/htdocs> DirectoryIndex index.html index.php Order Deny,Allow Allow from all </Directory> </VirtualHost> ~~~ 但是这样的配置在2.4.x下是不行的,应该将设置改成如下: ~~~ <VirtualHost *:80> DocumentRoot "D:/www/sphinx/api" ServerName www.mysphinx.com <Directory "D:/www/sphinx/api"> Options FollowSymLinks Indexes Require all granted AllowOverride All(有这行代码才能隐藏index.php) </Directory> </VirtualHost> ~~~ 这样就算大功告成了。 其中的一些指令已经无效,如: ~~~ Order Deny,Allow Deny from all Allow from al ~~~ 取而代之的是: ~~~ Deny from all ~~~ 变成 ~~~ Require all denied ~~~ ~~~ Allow from all ~~~ 变成 ~~~ Require all granted ~~~