Leon Overweel Leon Overweel - 2 months ago 8x
Apache Configuration Question

Trying to run Flask on Apache: error 13 (search permissions missing)

I'm trying to get a test Flask app running on my Ubuntu 16.04 / Apache 2.4 server, and I keep getting

errors when requesting pages.

The logs show the following:

[Wed Aug 17 10:13:39.782920 2016] [core:error] [pid 30612:tid 140294142019328] (13)Permission denied: [client] AH00035: access to /favicon.ico denied (filesystem path '/home/leon/opendc-production/web-server/opendc.wsgi') because search permissions are missing on a component of the path, referer: https://opendc.ewi.tudelft.nl/

I found the (13) Permission Denied page on Apache's website and followed the steps, doing
sudo chmod 644 opendc.wsgi
sudo chmod 644 hello.py
, and
sudo chmod 644 hello.pyc
, as well as
sudo chmod +x .
cd ..
all the way down.

I'm still getting the same "search permissions are missing on a component of the path" error.

Here's the output of ls -al in the

drwxrwx--- 3 leon leon 4096 Aug 17 10:36 .
drwxrwx--- 7 leon leon 4096 Aug 17 10:21 ..
-rw-rw---- 1 leon leon 93 Aug 16 14:13 .gitignore
-rw-r--r-- 1 leon leon 106 Aug 16 15:41 hello.py
-rw-r--r-- 1 leon leon 419 Aug 16 15:45 hello.pyc
-rw-rw---- 1 leon leon 54044 Aug 16 14:13 openapi-spec.yaml
-rw-r--r-- 1 leon leon 37 Aug 17 10:36 opendc.wsgi
-rw-rw---- 1 leon leon 410 Aug 16 14:13 README.md
drwxrwx--- 6 leon leon 4096 Aug 16 15:40 venv

Here's the contents of

from hello import app as application

Here's the contents of

from flask import Flask
app = Flask(__name__)

def hello_world():
return 'Hello, OpenDC!'

Here's the contents of my

<VirtualHost *:443>

# Meta

ServerAdmin l.overweel@gmail.com
ServerName opendc.ewi.tudelft.nl:443


SSLEngine on
SSLCertificateFile /root/opendc.ewi.tudelft.nl.crt
SSLCertificateKeyFile /root/opendc.ewi.tudelft.nl.key
SSLCertificateChainFile /root/DigiCertCA.crt

# WSGI Python app

WSGIDaemonProcess opendc user=leon group=adm threads=5
WSGIScriptAlias / /home/leon/opendc-production/web-server/opendc.wsgi

<Directory /home/leon/opendc-production/web-server>
WSGIProcessGroup opendc
WSGIApplicationGroup %{GLOBAL}
Require all granted

Another thing to note is that I followed the Flask installation guide, so I have python in a
, which I've never used before. Don't know if that changes anything or if I'm supposed to do anything differently because of that.

I also found this SO question and followed the advice in there, but it didn't change anything.


Apache runs as a special user. If your files are under your home directory it will not be able to read them. Better to move them outside of your home directory. Otherwise you have to do chmod o+rx on all directories down to where files are located, which goes against what your OS has setup for you.