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

Flask App Getting AH01630: client denied by server configuration error in Apache

尝试向我的 Flask 应用程序发送请求时出现 403 Forbidden。

在网上找到了很多关于此错误的示例,但到目前为止 none 的解决方案对我有用。

apache 错误日志文件中的错误:

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

这是我的虚拟主机。

<VirtualHost *:80>
  ServerName MY_SERVER_NAME
  DocumentRoot /opt/MyTinyURL

  WSGIDaemonProcess webtool user=www-data group=www-data threads=5 home=/opt/MyTinyURL/
  WSGIScriptAlias / "/opt/MyTinyURL/webtool.wsgi"

  <Directory "/opt/MyTinyUrl">
    Options Indexes FollowSymLinks MultiViews ExecCGI
    AllowOverride None
    Require all granted
    WSGIProcessGroup webtool
    WSGIApplicationGroup %{GLOBAL}
    WSGIScriptReloading On
  </Directory>
</VirtualHost>

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>