python - How to solve permission errors when deploying flask app on apache using wsgi? -
i having issue deploying flask app on apache2 using wsgi. apache2 restarts if running fine, when try access browser "403 forbidden" error. here code.
webroombooker.wsgi
#!/usr/bin/python import sys import logging logging.basicconfig(stream=sys.stderr) sys.path.insert(0,"/home/pi/website/webroombooker.py") webroombooker import app application
here directory tree of directory flask application , wsgi file in.
/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
and here apache virtual host file.
<virtualhost *:80> servername localhost wsgiscriptalias / /home/pi/website/webroombooker.wsgi <directory /home/pi/website/webroombooker.py/> require granted </directory> errorlog ${apache_log_dir}/error.log loglevel warn customlog ${apache_log_dir}/access.log combined </virtualhost>
here relevant error log lines showing error now.
[thu nov 17 14:07:39.939432 2016] [authz_core:error] [pid 15949:tid 1972368432] [client ::1:55490] ah01630: client denied 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 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 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 server configuration: /home/pi/website/webroombooker.wsgi, referer: http://localhost/
i'm pretty new appreciate it. thank in advanced help.
it's result of unix permissions on file apache accessing. apache runs user www-data
, files owned user. try running sudo chmod a+w <filename>
relevant files, wsgi files
Comments
Post a Comment