I've installing apcupsd in a fresh installation of CentOS 7 that is running Apache/2.4.6 (CentOS).
I installed the CGI status for apcupsd, but I continue to get the error message when attempting to access the page from another workstation:
Forbidden
You don't have permission to access /apcupsd/upsstats.cgi on this server.
The url for it on the LAN looks like this:
http://mysite/apcupsd/upsstats.cgi?host=127.0.0.1&temp=F
If I run this URL on a web browser on the server, it works fine.
So I figured that Apache doesn't know that apcupsd is located in /var/www/apcupsd, so I better go tell it.
However, when I look in /etc/httpd/conf.d I see there is an apcupsd.conf which looks like this:
#
# apcupsd configuration file for Apache Web server
#
# files are off the documentroot of Web server
Alias /apcupsd /var/www/apcupsd
<Directory /var/www/apcupsd>
AddHandler cgi-script cgi pl
Options ExecCGI
</Directory>
#
# Allow only local access at default
# Change the ".example.com" to match your domain or modify
# access rights to your needs to enable remote access also.
#
<Directory "/var/www/apcupsd">
DirectoryIndex upsstats.cgi
AllowOverride None
Options ExecCGI Indexes
<IfModule mod_authz_core.c>
# Apache 2.4
Require local
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order deny,allow
Deny from all
Allow from 127.0.0.1
Allow from ::1
</IfModule>
</Directory>
So I see there is already scripting there to tell it that /apcupsd is /var/www/apcupsd.
Yet it isn't working for the CGI because I get the error message above.
Do I need to do something else so this file in conf.d is loaded/executed? Does /etc/httpd/conf/httpd.conf needed to be edited, if so why and to what, because I see the "alias" is being done in the conf.d for apcupsd.conf. Seems like this is all in place and it should work.
What am I overlooking?
Having two
Directory
sections for exactly the same directory is a bad idea in most circumstances, so merge them together. For example you have Options in both, so one will always override the other since they are both setting the options in an absolute manner.Check the error log. Apache always logs something when it generates the 403 Forbidden message. If there is nothing in the log, then either you are looking in the wrong log or your CGI generated the 403 itself (there is actually one other possibility, but it is an edge case, if you have a
RewriteRule
with the 'F' flag).One other comment, the directive
Require local
doesn't look valid to me, so are you really using Apache v2.4?