Reputation: 8714
I am trying to configure mod_wsgi on Apache to work with SSL certificate.
This is 403 error that I am getting when I access https://servername.com
You don't have permission to access / on this server.
This is how my apache configuration file looks like:
<VirtualHost *:443>
ServerName servername.com
ServerAlias www.servername.com
# Django Application
Alias /static /root/www/static
<Directory /root/www/static>
Require all granted
</Directory>
<Directory /root/www/appname/apache>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIDaemonProcess appname python-path=/root/www:/root/www/env/lib/python3.4/site-packages
WSGIProcessGroup appname
WSGIScriptAlias / /root/www/appname/apache/wsgi.py
SSLEngine on
SSLCertificateFile /home/appname/appname.com.crt
SSLCertificateKeyFile /home/appname/appname.com.key
SSLCertificateChainFile /home/appname/intermediate.crt
</VirtualHost>
And this is my folder structure with permissions:
/root/www/
drwxr-xr-x 9 www-data www-data 4096 Mar 23 18:33 www
/root/www/appname
drwxr-xr-x 4 www-data www-data 4096 Mar 24 09:15 appname
cd /root/www/appname
ls -la
-rwxr-xr-x 1 www-data www-data 0 Jul 25 2015 __init__.py
drwxr-xr-x 2 www-data www-data 4096 Mar 21 10:54 __pycache__
drwxr-xr-x 2 root root 4096 Mar 24 09:15 apache
-rwxr-xr-x 1 www-data www-data 5199 Mar 24 08:50 settings.py
-rwxr-xr-x 1 www-data www-data 4504 Mar 18 06:14 urls.py
cd /root/www/appname/apache
ls -la
-rw-r--r-- 1 root root 0 Mar 24 09:15 __init__.py
-rw-r--r-- 1 root root 395 Mar 24 09:15 wsgi.py
Can someone see a problem here?
Thanks!
Upvotes: 2
Views: 2427
Reputation: 8714
I was missing execute permission on the every folder in the path.
I solved it with adding it.
chmod +x /root
chmod +x /root/www
chmod -R +x /root/www/appname
Upvotes: 4