在 centos 6.5 上使用 puppetlabs/apache 设置 suPHP

在 centos 6.5 上使用 puppetlabs/apache 设置 suPHP

我正在尝试使用 puppetlabs/apache 模块在 centos 6.5 盒子上设置 suPHP。

Apache 配置

file { "/var/www/vhosts":
        ensure => "directory",
        owner  => "root",
        group  => "root",
        mode   => 755,
    }

    class { '::apache':  
        require => File['/var/www/vhosts'],
    }

    include ::apache::mod::suphp

Vhosts 示例

apache::vhost { $site:
    port            => '80',
    serveraliases   => [
        $root,
        "www.${site}",
        "development.${site}",
        "www.development.${site}",
    ],
    options => ['Indexes', 'FollowSymlinks'],
    suphp_engine        => 'on',
    suphp_addhandler    => 'x-httpd-suphp',
    suphp_configpath    => '/etc/httpd/conf.d/suphp.conf',
    directories         => { 
        path => "${_root}/${webroot}",
        'suphp' => { 
            user => $owner, 
            group => $group 
        },
    },
    override        => 'ALL',
    logroot         => "${_root}/${logroot}",
    docroot         => "${_root}/${webroot}",
    docroot_owner   => $owner,
    docroot_group   => $group,
}

应用这些时mod_suphp无法找到,所以我安装并启用了 rpm forge。

[rpmforge]
name = RHEL $releasever - RPMforge.net - dag
baseurl = http://apt.sw.be/redhat/el6/en/$basearch/rpmforge
mirrorlist = http://apt.sw.be/redhat/el6/en/mirrors-rpmforge
#mirrorlist = file:///etc/yum.repos.d/mirrors-rpmforge
enabled = 1
protect = 0
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag
gpgcheck = 1

我重新运行它并安装它但现在我500 internal server error在 php 页面上得到了一个。

apache 日志显示了这一点。

[Mon Dec 08 16:51:02 2014] [error] [client 192.168.50.1] SecurityException in Application.cpp:496: Handler not found in configuration
[Mon Dec 08 16:51:02 2014] [error] [client 192.168.50.1] Caused by KeyNotFoundException in Configuration.cpp:234: Handler "application/x-httpd-suphp" not found
[Mon Dec 08 16:51:02 2014] [error] [client 192.168.50.1] Premature end of script headers: index.php

suphp 日志是空的。

答案1

检查确保 vhost 定义中的 x-httpd-suphp 与 中定义的处理程序匹配/etc/httpd/conf.d/suphp.conf。例如:

application/x-httpd-suphp="php:/usr/bin/php-cgi"

相关内容