Running php-fpm with httpd 2.4.4 in CentOS 6.4

frenchja asked:

I upgraded to httpd 2.4.4 from the httpd 2.2 that shipped with CentOS/RHEL 6.4. I’m running into an error trying to serve Roundcube mail using php-fpm. We tried a number of solutions on #httpd at Freenode. I would greatly appreciate any insight. It worked well with httpd 2.2.

These instructions were followed so far: https://wiki.apache.org/httpd/PHP-FPM

The error I get is Forbidden: You don't have permission to access / on this server. The error log says:

[Fri Sep 06 15:26:23.542241 2013] [autoindex:error] [pid 16868:tid 140266652563200] [client 129.105.171.78:50823] AH01276: Cannot serve directory /var/www/roundcubemail/: No matching DirectoryIndex (index.html) found, and server-generated directory index forbidden by Options directive

VirtualHost in /etc/httpd/conf.d/ssl.conf

<VirtualHost *:443>
    ServerName mail.mydomain.org
    DocumentRoot /var/www/roundcubemail
    SSLEngine on
    SSLCertificateFile /etc/pki/tls/certs/domain.crt
    SSLCertificateKeyFile /etc/pki/tls/private/domain.key
    ProxyPassMatch ^/(.*.php(/.*)?)$ fcgi://127.0.0.1:9000/var/www/roundcubemail/$1
</VirtualHost>

/etc/httpd/conf.d/roundcubemail.conf

<Directory "/var/www/roundcubemail/">
    Options -Indexes
    SetOutputFilter DEFLATE
    AllowOverride All
    Require all granted
</Directory>

/var/www/roundcubemail/.htaccess

AddDefaultCharset     UTF-8
AddType text/x-component .htc

<IfModule mod_php5.c>
php_flag        display_errors  Off
php_flag        log_errors      On
# php_value     error_log       logs/errors

php_value       upload_max_filesize     5M
php_value       post_max_size           6M
php_value       memory_limit            64M

php_flag        zlib.output_compression         Off
php_flag        magic_quotes_gpc                Off
php_flag        magic_quotes_runtime            Off
php_flag        zend.ze1_compatibility_mode     Off
php_flag        suhosin.session.encrypt         Off

#php_value      session.cookie_path             /
php_flag        session.auto_start      Off
php_value       session.gc_maxlifetime  21600
php_value       session.gc_divisor      500
php_value       session.gc_probability  1

# http://bugs.php.net/bug.php?id=30766
php_value       mbstring.func_overload  0
</IfModule>

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^favicon.ico$ skins/larry/images/favicon.ico
# security rules
RewriteRule .git - [F]
RewriteRule ^/?(README(.md)?|INSTALL|LICENSE|CHANGELOG|UPGRADING)$ - [F]
RewriteRule ^/?(SQL|bin) - [F]
</IfModule>

<IfModule mod_deflate.c>
SetOutputFilter DEFLATE
</IfModule>

<IfModule mod_headers.c>
# replace 'append' with 'merge' for Apache version 2.2.9 and later
#Header append Cache-Control public env=!NO_CACHE
</IfModule>

<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 1 month"
</IfModule>

FileETag MTime Size

<IfModule mod_autoindex.c>
Options -Indexes
</ifModule>

My answer:


It’s PHP, isn’t it? Your VirtualHost should also contain:

DirectoryIndex index.php

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.