Having no end of problems running Flask under Apache using Plesk. Really been scratching my head with this one.
As I am using Plesk, I realise that I need to use the vhosts conf files under /var/www/vhosts instead of the virtualhost config (sitting under the typical "sites-available" directory in Apache).
When I attempt to run my Flask App, I receive the error within my Apache error log:
Timeout when reading response headers from daemon process 'unifica': /apps/start.wsgi
My wsgi application file lives here:
/apps/start.wsgi
and reads as follows:
activate_this = '/apps/unifica/venv/bin/activate_this.py'
execfile(activate_this, dict(__file__=activate_this))
from unifica import app as application
As you will notice. I am using a Virtual Environment. Subsequently, my actual application lives here:
apps/unifica/main.py
and reads as follows:
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello, World!'
if __name__ == "__main__":
app.run(host='0.0.0.0')
As my site is secured over ssl; I have the following two vhost configurations:
vhost.conf and vhost_ssl.conf
My vhost.conf contains:
RewriteEngine On
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
(to redirect insecure requests)
My vhost_ssl.conf contains:
WSGIDaemonProcess unifica user=flaskuser group=flaskgroup threads=5
WSGIScriptAlias / /apps/start.wsgi
<Directory /apps >
WSGIProcessGroup unifica
WSGIApplicationGroup %{GLOBAL}
Require all granted
WSGIScriptReloading On
</Directory>
flaskuser exists and belongs to flaskgroup. I have assigned 0755 rights to flaskuser (as the owner) on the /apps/ folder.
Any idea where I am going wrong here? I presume I have made a fairly obvious mistake somewhere...
Aucun commentaire:
Enregistrer un commentaire