I'm just setting up an Apache 2.4 web server on CentOS 7.5, but I'm having SELinux issues. Basically I'm getting "Permission denied" errors when I try to execute a simple cgi test script (which is in a /cgi-bin/ directory under /var/www/site/...). After having tried multiple things I narrowed it down to SELinux by temporarily disabling it (i.e. # setenforce 0), and finding that the script then works just fine. Of course, I'd much prefer to have SELinux fully enabled and still have the scripts working.
So, here are a few things I tried:
Code: Select all
# restorecon -R public_html
Code: Select all
# semanage boolean -m --on httpd_enable_cgi
Code: Select all
# ls -lZ
-rwxrwxr-x. apache apache unconfined_u:object_r:httpd_sys_content_t:s0 test.cgi
Code: Select all
[May 17 ...] [cgid:error] [pid 100599] (13)Permission denied: AH01241: exec of '/var/www/sites/site1/cgi-bin/test.cgi' failed
Also, I know I could do something like "# semanage permissive -a httpd_t", but that's also not my ideal solution.
If someone could point me in the right direction (or, more specifically, tell me exactly how to fix it) I'd be most appreciative. Many thanks!