Flask App获取AH01630:Apache中的服务器配置错误导致客户端被拒绝

时间:2018-04-13 00:00:38

标签: python apache flask mod-wsgi

尝试向Flask应用程序发送请求时获取403 Forbidden。

在线查找了很多关于此错误的示例,但到目前为止,这些解决方案都不适合我。

apache错误日志文件出错:

C:\WINDOWS\system32>mklink /d "C:\Program Files (x86)\MySQL\MySQL Connector C 6.0.2\include" "C:\Program Files\MySQL\MySQL Connector C 6.0.2\include"
The system cannot find the path specified.

这是我的VirtualHost。

AH01630: client denied by server configuration: /opt/MyTinyURL/webtool.wsgi

1 个答案:

答案 0 :(得分:0)

UNIX文件路径名区分大小写。与WSGIScriptAlias一起使用的路径与Directory指令中使用的路径不匹配。

使用不需要的东西清理一些其他问题,请尝试使用:

<VirtualHost *:80>
  ServerName MY_SERVER_NAME

  # XXX Bad practice to set DocumentRoot to be directory
  # where your code is. Comment out WSGIScriptAlias and
  # people could download your source code.
  # DocumentRoot /opt/MyTinyURL

  # XXX Don't need user/group as the default to Apache user.
  WSGIDaemonProcess webtool threads=5 home=/opt/MyTinyURL/
  WSGIScriptAlias / "/opt/MyTinyURL/webtool.wsgi"

  # XXX You had MyTinyUrl and not MyTinyURL.
  <Directory "/opt/MyTinyURL">
    Options Indexes FollowSymLinks MultiViews ExecCGI
    AllowOverride None
    Require all granted
    WSGIProcessGroup webtool
    WSGIApplicationGroup %{GLOBAL}
    # XXX Script reloading is the default option.
    # WSGIScriptReloading On
  </Directory>
</VirtualHost>