【发布时间】:2017-04-01 11:20:01
【问题描述】:
我在使用 wsgi 在 apache2 上部署烧瓶应用程序时遇到问题。 Apache2 重新启动,好像它运行良好,但是当我尝试使用浏览器访问它时,我收到“403 Forbidden”错误。这是我的代码。
webroombooker.wsgi
#!/usr/bin/python
import sys
import logging
logging.basicConfig(stream=sys.stderr)
sys.path.insert(0,"/home/pi/Website/webroombooker.py")
from webroombooker import app as application
这是我的 Flask 应用程序和 wsgi 文件所在目录的目录树。
/home/pi/Website
├── hellotest.py
├── hellotest.pyc
├── index.html.en
├── index.html.en~orig.html
├── main.html
├── PoweredByMacOSX.gif
├── PoweredByMacOSXLarge.gif
├── templates
│ ├── profile.html
│ ├── registration2.html
│ ├── registration.html
│ ├── seleniumtemplate2.html
│ └── seleniumtemplatetime.html
├── Test
├── webroombooker.py
├── webroombooker.pyc
└── webroombooker.wsgi
这里是 apache 虚拟主机文件。
<VirtualHost *:80>
ServerName localhost
WSGIScriptAlias / /home/pi/Website/webroombooker.wsgi
<Directory /home/pi/Website/webroombooker.py/>
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
这里是相关的错误日志行 实际上它现在显示错误。
[Thu Nov 17 14:07:39.939432 2016] [authz_core:error] [pid 15949:tid 1972368432] [client ::1:55490] AH01630: client denied by server configuration: /home/pi/Website/webroombooker.wsgi
[Thu Nov 17 14:07:40.260731 2016] [authz_core:error] [pid 15949:tid 1963979824] [client ::1:55490] AH01630: client denied by server configuration: /home/pi/Website/webroombooker.wsgi, referer: http://localhost/
[Thu Nov 17 14:07:43.506135 2016] [authz_core:error] [pid 15949:tid 1955591216] [client ::1:55490] AH01630: client denied by server configuration: /home/pi/Website/webroombooker.wsgi
[Thu Nov 17 14:07:43.702542 2016] [authz_core:error] [pid 15949:tid 1947202608] [client ::1:55490] AH01630: client denied by server configuration: /home/pi/Website/webroombooker.wsgi, referer: http://localhost/
我对此很陌生,所以我真的很感激。非常感谢您的帮助。
【问题讨论】:
-
你能告诉我们apache日志文件的相关行吗?
-
由于某种原因,当我请求站点时,apache 日志没有显示任何错误。
-
实际上它现在显示错误。我来发一下
标签: python linux apache flask apache2