Trying to get FCGId on CentOS 6.7 to work.

I’ve been scratching my head about this for a long time, trying to get it to work.

I am getting 403 permission denied when trying to access the website.

Here are my config files:

Directives for Virtual Host

SuexecUserGroup "#533" "#526"
ServerName domain.com
ServerAlias www.domain.com
ServerAlias webmail.domain.com
ServerAlias admin.domain.com
DocumentRoot /home/domain/public_html
ErrorLog /var/log/virtualmin/domain.com_error_log
CustomLog /var/log/virtualmin/domain.com_access_log combined
ScriptAlias /cgi-bin/ /home/domain/fcgi-bin/
ScriptAlias /awstats/ /home/domain/cgi-bin/
DirectoryIndex index.html index.htm index.php index.php4 index.php5
<Directory /home/domain/public_html>
Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch +ExecCGI
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
AddType application/x-httpd-php .php5
AddType application/x-httpd-php .php
AddHandler fcgid-script .php
AddHandler fcgid-script .php5
FCGIWrapper /home/domain/fcgi-bin/php5.fcgi .php5
FCGIWrapper /home/domain/fcgi-bin/php5.fcgi .php
</Directory>
<Directory /home/domain/cgi-bin>
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
</Directory>
RewriteEngine on
RewriteCond %{HTTP_HOST} =webmail.domain.com.
RewriteRule ^(.*) https://domain.com.:24984/ [R]
RewriteCond %{HTTP_HOST} =admin.domain.com.
RewriteRule ^(.*) https://domain.com.:14984/ [R]
Alias /dav /home/domain/public_html
<Location /dav>
DAV on
AuthType Basic
AuthName "domain.com."
AuthUserFile /home/domain/etc/dav.digest.passwd
Require valid-user
ForceType text/plain
Satisfy All
RewriteEngine off
</Location>
<Files awstats.pl>
AuthName "domain.com. statistics"
AuthType Basic
AuthUserFile /home/domain/.awstats-htpasswd
require valid-user
</Files>
IPCCommTimeout 61
RemoveHandler .php
RemoveHandler .php5
php_admin_value engine Off
FcgidMaxRequestLen 1073741824

Here is my php.con in /etc/httpd/conf.d/

#
# PHP is an HTML-embedded scripting language which attempts to make it
# easy for developers to write dynamically generated webpages.
#
<IfModule prefork.c>
  LoadModule php5_module modules/libphp5.so
</IfModule>

<IfModule !prefork.c>
  LoadModule php5_module modules/libphp5-zts.so
</IfModule>

#
# Cause the PHP interpreter to handle files with a .php extension.
#
<FilesMatch \.php$>
   SetHandler application/x-httpd-php
</FilesMatch>

#
# Allow php to handle Multiviews
#
AddType text/html .php

#
# Add index.php to the list of files that will be served as directory
# indexes.
#
DirectoryIndex index.php

#
# Uncomment the following lines to allow PHP to pretty-print .phps
# files as PHP source code:
#
#<FilesMatch \.phps$>
#    SetHandler application/x-httpd-php-source
#</FilesMatch>

#
# Apache specific PHP configuration options
# those can be override in each configured vhost
#
php_value session.save_handler "files"
php_value session.save_path    "/var/lib/php/session"
php_value soap.wsdl_cache_dir  "/var/lib/php/wsdlcache"
~                                                         

And here is /home/domain/fcgi-bin/php5.fcgi

PHPRC=$PWD/../etc/php5/
export PHPRC
umask 022
SCRIPT_FILENAME=$PATH_TRANSLATED
export SCRIPT_FILENAME
exec /usr/bin/php-cgi

Directories are all 755 except for public_html which is 644.

I would be really thankful if someone could help me!

Howdy,

If you look in $HOME/logs/access_log for that domain, are you seeing the access attempt? This is just to verify that the requests are hitting the correct domain.

If so, is there perhaps a .htaccess file that’s restricting access?

If you do have an htaccess file, try temporarily renaming it to see if that helps.

-Eric

Thanks for the reply!

I checked the access_log, and it’s logging my requests. The site works fine with mod_php, I can’t imagine any directives in .htaccess would block FCGId but not mod_php? I renamed it anyway, without any luck.

I also checked that the user and group are the ones that are specified at the top.