Reputation: 2168
Thank you in advance for any help on this, I am a bit of a newb and have been looking everywhere to figure what I am doing wrong.
I have the Apache 2.4.6, python 2.7 centos 7.
I have a simple python script
/var/www/html/test.py
In the script it has
#!/usr/bin/env python
print 'Hello World!'
The permission have been checked (777 just because I can't figure it out):
-rwxrwxrwx. 1 apache apache 192 Aug 27 11:45 test.py
running the command
/var/www/html/test.py
works find and displays Hello World!
The log for apache says
[Thu Aug 27 11:38:53.703606 2015] [cgi:error] [pid 10218] [client 86.159.50.246:61086] AH01215: (13)Permission denied: exec of '/var/www/html/test.py' failed
The relevant apache configuration is as follows:
LoadModule wsgi_module modules/mod_wsgi.so
<Directory /var/www/html/>
Order allow,deny
Require all granted
allow from all
Options +ExecCGI
AddHandler cgi-script .py
</Directory>
Any help would be greatly appreciated because I have no idea what else I am doing wrong!
Upvotes: 0
Views: 2847
Reputation: 2168
I finally figured out the issue. It was that I installed mod_wsgi with yum and it was precomilid for a different version of python. It works with SE linux inabled. To fisc the issue I ran the following lines of code
yum install httpd-devel
git clone https://github.com/GrahamDumpleton/mod_wsgi.git
cd mod_wsgi
./configure --with-python=/usr/bin/python2.7
make
make install
Then it output the path of the module (.so) file. It looked right but just for completeness sake I change the file: /etc/httpd/conf.modules.d/10-wsgi.conf
from
LoadModule wsgi_module modules/mod_wsgi.so
to
LoadModule wsgi_module /usr/lib64/httpd/modules/mod_wsgi.so
because that was the output path of the make step and it worked!!
Upvotes: 0