I have the following CGI script which launches a Flask web application. However all I get is a 500 Internal Server Error
#!/home/xxx/public_html/cgi-bin/venv/bin/python
import site
site.addsitedir("/home/xxx/public_html/cgi-bin/venv/lib/python2.7/site-packages")
from wsgiref.handlers import CGIHandler
from app import app
CGIHandler().run(app)
I get the following errors in Apache's error_log
:
[Fri Jan 27 09:53:18.052981 2017] [cgi:error] [pid 20660] [client aa.bb.cc.dd:58331] AH01215: suexec policy violation: see suexec log for more details: /home/xxx/public_html/cgi-bin/app.cgi, referer: http://xxx.io/
[Fri Jan 27 09:53:18.053176 2017] [cgi:error] [pid 20660] [client aa.bb.cc.dd:58331] End of script output before headers: app.cgi, referer: http://xxx.io/
And the following error in suexec_log
:
[2017-01-27 09:53:18]: uid: (522/xxx) gid: (534/xxx) cmd: app.cgi
[2017-01-27 09:53:18]: (2)No such file or directory: exec failed (app.cgi)
All the files should be in all the right places. Not sure how to proceed with debugging. If it helps, I do have root access to this server.
Two problems:
.cgi
file contained Windows line endings
:set ff=unix
in VimOnce I solved those, it works like a charm!