尝试使用apache阻止直接IP访问

时间:2017-01-15 17:27:57

标签: apache xampp

我在Windows计算机上使用XAMPP,并且我已将此代码添加到httpd.conf文件中:

<VirtualHost *:80>
    ServerName 23.23.23.23.23
    Redirect 403 /
    ErrorDocument 403 "No"
    DocumentRoot C:/xampp/htdocs
    UseCanonicalName Off
    UserDir disabled
</VirtualHost>

当我尝试重新启动apache时出现此错误:

11:15:02 AM  [Apache]   Error: Apache shutdown unexpectedly.
11:15:02 AM  [Apache]   This may be due to a blocked port, missing dependencies, 
11:15:02 AM  [Apache]   improper privileges, a crash, or a shutdown by another method.
11:15:02 AM  [Apache]   Press the Logs button to view error logs and check
11:15:02 AM  [Apache]   the Windows Event Viewer for more clues
11:15:02 AM  [Apache]   If you need more help, copy and post this
11:15:02 AM  [Apache]   entire log window on the forums

如果我从httpd.conf文件中删除代码,它将会启动。这里发生了什么?

1 个答案:

答案 0 :(得分:0)

从配置中删除UserDir disabled将解决您的问题。