This happens because of the lack of permissions. Nagios files and folders are under the ownership of the user nagios. So we need to add the nagios user to the Apache group to resolve this problem.
#usermod -a -G nagios www-data
Please note that the Apache group here is 'www-data' and this may vary according to the Linux distributions.