matsair
By:
matsair

403 Forbidden using Flask, WSGI and Apache2

October 27, 2016 83 views
Apache Debian

I'm getting 403 Forbidden when trying to access my Flask app from my local notebook using my Droplet's IP. Any help would be appreciated!

This is my Apache2 error log:

[Thu Oct 27 08:33:22.308733 2016] [authz_core:debug] [pid 24390:tid 140263676557056] mod_authz_core.c(809): [client 134.155.212.122:60940] AH01626: authorization result of Require all denied: denied
[Thu Oct 27 08:33:22.308770 2016] [authz_core:debug] [pid 24390:tid 140263676557056] mod_authz_core.c(809): [client 134.155.212.122:60940] AH01626: authorization result of <RequireAny>: denied
[Thu Oct 27 08:33:22.308774 2016] [authz_core:error] [pid 24390:tid 140263676557056] [client 134.155.212.122:60940] AH01630: client denied by server configuration: /home/mats/var/www/TVApp/tvapp.wsgi

This is my conf file:

<VirtualHost *:80>
                ServerName xx.xxx.xxx.xx
                ServerAdmin xx@xxx.xxx
                WSGIScriptAlias / /home/mats/var/www/TVApp/tvapp.wsgi
                <Directory /home/mats/var/www/TVApp/TVApp/>
                        Require all granted
                </Directory>
                Alias /static /home/mats/var/www/TVApp/TVApp/static
                <Directory /home/mats/var/www/TVApp/TVApp/static/>
                        Require all granted
                </Directory>
                ErrorLog ${APACHE_LOG_DIR}/error.log
                LogLevel debug
                CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

My wsgi file:

#!/usr/bin/python
import sys
import logging
logging.basicConfig(stream=sys.stderr)
sys.path.insert(0,"/var/www/TVApp/")

from TVApp import app as application
application.secret_key = 'Add your secret key'

This is the output of apachectl -S:

AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
VirtualHost configuration:
*:80                   46.101.208.32 (/etc/apache2/sites-enabled/TVApp.conf:1)
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex watchdog-callback: using_defaults
Mutex default: dir="/var/lock/apache2" mechanism=fcntl 
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www-data" id=33
Group: name="www-data" id=33
Be the first one to answer this question.