Issue
I am using httpd2.4
with mod-wsgi
installed on Amazon linux.
My wsgi
script looks like this:
/projects/mv2/test/test.wsgi
import sys
import os
sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)))
from test import *
/projects/mv2/test/test.py
from flask import Flask
app = Flask(__name__)
@app.route('/test')
def hello_world():
return 'Hello, World!'
Apache conf file
<VirtualHost *:80>
ServerName test-algo.com
WSGIDaemonProcess algos_app user=mv2 group=mv2 threads=1
WSGIScriptAlias / /projects/mv2/test/test.wsgi
<Directory /projects/mv2/test/test>
WSGIProcessGroup algos_app
WSGIApplicationGroup %{GLOBAL}
Options MultiViews FollowSymLinks
AllowOverride all
Require all granted
</Directory>
</VirtualHost>
When I hit the url http://test-algo.com/test
, I get a 403 response and the following the httpd error file
[authz_core:error] [pid 27555] [client 153.156.225.142:65083] AH01630: client denied by server configuration: /projects/mv2/test/test.wgi
I am not able to find what is wrong with the wsgi
script.
Solution
The Directory
blog should start with:
<Directory /projects/mv2/test>
You have an extra test
at end of path.
That would cause the 403 error.
The WSGI script should also use:
from test import app as application
The name of the WSGI entry point is expected to be application
not app
as your Flask file uses.
If don't fix this you will get a different error after fixing the first.
Answered By - Graham Dumpleton Answer Checked By - Marilyn (WPSolving Volunteer)