I have some troubles with the WSGI script and Apache. CKAN runs on Centos 7 in a virtualenv. Nginx proxies the requests to apache who listens on port 8080. Unfortunately, apache is not able to execute the WSGI script.
apache.wsgi
import os
activate_this = os.path.join('/usr/lib/ckan/default/bin/activate_this.py')
execfile(activate_this, dict(__file__=activate_this))
from paste.deploy import loadapp
config_filepath = os.path.join(os.path.dirname(os.path.abspath(__file__)),
'production.ini')
from paste.script.util.logging_config import fileConfig
fileConfig(config_filepath)
application = loadapp('config:%s' % config_filepath)``
Apache ckan.conf
WSGISocketPrefix /var/run/wsgi
<VirtualHost 0.0.0.0:8080>
ServerName opendata-luzern.org
WSGIScriptAlias / /etc/ckan/default/apache.wsgi
# Pass authorization info on (needed for rest api).
WSGIPassAuthorization On
# Deploy as a daemon (avoids conflicts between CKAN instances).
WSGIDaemonProcess ckan_default python-path=/usr display-name=ckan_
default processes=2 threads=15
WSGIProcessGroup ckan_default
# Add this to avoid Apache show error:
# "AH01630: client denied by server configuration: /etc/ckan/default/apache.wsgi"
<Directory />
Require all granted
</Directory>
ErrorLog /var/log/httpd/ckan_default.error.log
CustomLog /var/log/httpd/ckan_default.custom.log combined
And the output from the apache error log:
[Mon May 22 08:46:48.274364 2017] [:error] [pid 5699] [remote 127.0.0.1:240] mod_wsgi (pid=5699): Target WSGI script '/etc/ckan/default/apache.wsgi' cannot be loaded as Python module.
[Mon May 22 08:46:48.274378 2017] [:error] [pid 5699] [remote 127.0.0.1:240] mod_wsgi (pid=5699): Exception occurred processing WSGI script '/etc/ckan/default/apache.wsgi'.
[Mon May 22 08:46:48.274395 2017] [:error] [pid 5699] [remote 127.0.0.1:240] Traceback (most recent call last):
[Mon May 22 08:46:48.274415 2017] [:error] [pid 5699] [remote 127.0.0.1:240] File "/etc/ckan/default/apache.wsgi", line 3, in <module>
[Mon May 22 08:46:48.274462 2017] [:error] [pid 5699] [remote 127.0.0.1:240] execfile(activate_this, dict(__file__=activate_this))
[Mon May 22 08:46:48.274491 2017] [:error] [pid 5699] [remote 127.0.0.1:240] IOError: [Errno 13] Permission denied: '/usr/lib/ckan/default/bin/activate_this.py'
Apache should be able to access these files:
-rw-rw-r--. 1 ckan apache 403 May 22 07:42 /etc/ckan/default/apache.wsgi
-rw-rw-r--. 1 ckan apache 1129 Apr 5 10:35 /usr/lib/ckan/default/bin/activate_this.py
Are there any other permissions apache must have to be able to perform the request?
Thanks, Reto