I am trying to configure Apache HTTP Server by running a web application using Apache's mod_fgcid, a module for FastCGI. I have put a configuration file which allows the interface of my app to be available at port 3001 on my server.

http://203.0.113.111:3001

so I have it in there

$cd /etc/httpd/conf.d
$ ls
autoindex.conf  myappapache.conf  fcgid.conf  README  userdir.conf  welcome.conf

If I nano into that it is like this

Listen 3001

<VirtualHost *:3001>

  DocumentRoot /src/appG/root

  Alias /static /src/appG/root/static

  <Location /static>
    SetHandler default-handler
  </Location>

  # The app Webapp itself
  Alias / /src/appG/script/appGweb_fastcgi.pl/

  <Location />
    Options ExecCGI
    Order allow,deny
    Allow from all
 AddHandler fcgid-script .pl
  </Location>

</VirtualHost>

however, I get the following error but when I do this http://203.0.113.111 I get the "testing 123" page which is used to test the proper operation of the Apache HTTP server after it has been installed. "If you can read this page it means that this site is working properly." This server is powered by CentOS.

So it means that it works but when I use http://203.0.113.111:3001 I am forbidden access.

Forbidden

You don't have permission to access / on this server.

Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.

I also tried to give permission to my app by the following

sudo chmod -R +777 /appG

Apache version is

rpm -q httpd
httpd-2.4.6-80.el7.centos.1.x86_64

error_log is like below

[Tue Sep 04 15:55:36.440097 2018] [auth_digest:notice] [pid 1141] AH01757: generating secret for digest authentication ...
[Tue Sep 04 15:55:36.457510 2018] [lbmethod_heartbeat:notice] [pid 1141] AH02282: No slotmem from mod_heartmonitor
[Tue Sep 04 15:55:36.460477 2018] [mpm_prefork:notice] [pid 1141] AH00163: Apache/2.4.6 (CentOS) mod_fcgid/2.3.9 configured $
[Tue Sep 04 15:55:36.460525 2018] [core:notice] [pid 1141] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Tue Sep 04 16:19:16.332346 2018] [mpm_prefork:notice] [pid 1141] AH00170: caught SIGWINCH, shutting down gracefully
[Tue Sep 04 16:38:28.064533 2018] [core:notice] [pid 1139] SELinux policy enabled; httpd running as context system_u:system_$
[Tue Sep 04 16:38:28.399960 2018] [suexec:notice] [pid 1139] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the $
[Tue Sep 04 16:38:28.437880 2018] [auth_digest:notice] [pid 1139] AH01757: generating secret for digest authentication ...
[Tue Sep 04 16:38:28.438890 2018] [lbmethod_heartbeat:notice] [pid 1139] AH02282: No slotmem from mod_heartmonitor
[Tue Sep 04 16:38:28.448342 2018] [mpm_prefork:notice] [pid 1139] AH00163: Apache/2.4.6 (CentOS) mod_fcgid/2.3.9 configured $
[Tue Sep 04 16:38:28.448378 2018] [core:notice] [pid 1139] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Mon Sep 10 20:02:13.182661 2018] [mpm_prefork:notice] [pid 1139] AH00170: caught SIGWINCH, shutting down gracefully
[Mon Sep 10 20:02:15.228371 2018] [core:notice] [pid 6248] SELinux policy enabled; httpd running as context system_u:system_$
[Mon Sep 10 20:02:15.270444 2018] [suexec:notice] [pid 6248] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the $
[Mon Sep 10 20:02:15.300117 2018] [auth_digest:notice] [pid 6248] AH01757: generating secret for digest authentication ...
[Mon Sep 10 20:02:15.301853 2018] [lbmethod_heartbeat:notice] [pid 6248] AH02282: No slotmem from mod_heartmonitor
[Mon Sep 10 20:02:15.965909 2018] [mpm_prefork:notice] [pid 6248] AH00163: Apache/2.4.6 (CentOS) mod_fcgid/2.3.9 configured $
[Mon Sep 10 20:02:15.965981 2018] [core:notice] [pid 6248] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
  • What version of Apache are you on? "403 Forbidden error was encountered while trying to use an ErrorDocument" - a 403 has already occurred prior to this, that error is secondary to the main problem. Where is the ErrorDocument defined? What other config do you have on this server? – MrWhite Aug 28 at 22:04
  • @MrWhite I mentioned the version above, can you please tell me how to check the others? I will try to give you all the answers . Thanks – Nikolas Service Aug 28 at 22:35
  • "I mentioned the version above" - Ah yes, sorry missed that in my sleepy state! In that case, you are using the wrong authorisation directives in your config, you are using the directives for Apache 2.2. You should be using Require all granted etc. (Although that isn't necessarily the cause of your problem - but it can be) Other parts of your main server config might still be overriding your config. – MrWhite Aug 29 at 11:18
  • Your Alias directive would seem to be unnecessary? (Or you are using it incorrectly, as @Stephen suggests in his answer.) You only need an Alias if you want to serve content that is not under the DocumentRoot. – MrWhite Aug 29 at 11:55

That is usually because a directory above your document root isn't available to the user which the web server is running as. You need both read and execute permissions on all the directories above your document root. Try:

chmod a+rx /src/appG/root
chmod a+rx /src/appG/
chmod a+rx /src/
chmod a+rx /

Another problem could be your Alias / ... directive. Alias is usually used to map a subdirectory of the URL to a different place in your file system. You appear to be using it to instead map the entire URL to a specific perl file. I usually see rewrite rules used for doing that and I'm not sure that alias directives work for that.

Additionally you should check the error_log which is probably in /var/log/httpd That should have specific information in it about which file Apache can't access.

  • ♦ I still get the same error :-( what should I do? shoud I remove the ` alias` ? – Nikolas Service Aug 29 at 16:14
  • Yes. Try to remove pieces until you figure out what is causing the problem. – Stephen Ostermiller Aug 29 at 17:37
  • ♦ I removed the alias but did not solve the problem. I have been busy with it for few weeks now but it seems like does not work. any idea – Nikolas Service Sep 11 at 0:03
  • @MrWhite I put the output of error_log above in my question – Nikolas Service Sep 11 at 0:06
  • I don't see anything helpful in your error_log. Are there other log files with error messages in them? Some configurations put domain specific errors into their own log file. – Stephen Ostermiller Sep 13 at 19:16

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.