LINUX.ORG.RU
ФорумAdmin

fcgi ошибка 500 на centos

 


0

1

Доброго времени суток!

коллеги, помогите, пожалуйста, настроить fcgi, выдаёт 500 ошибку почему-то при входе на index.php.
Centos 7.

# httpd -v
Server version: Apache/2.4.6 (CentOS)
Server built:   Apr 12 2017 21:03:28

# /usr/sbin/suexec -V
 -D AP_DOC_ROOT="/www"
 -D AP_GID_MIN=100
 -D AP_HTTPD_USER="apache"
 -D AP_LOG_EXEC="/var/log/httpd/suexec.log"
 -D AP_SAFE_PATH="/usr/local/bin:/usr/bin:/bin"
 -D AP_UID_MIN=500
 -D AP_USERDIR_SUFFIX="public_html"

# apachectl -M | grep fcgi
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message
 proxy_fcgi_module (shared)
 fcgid_module (shared)


/etc/httpd/conf.d/site1.ru.conf
<VirtualHost *:80>
    ServerName site1.ru
    ServerAlias www.site1.ru
    DocumentRoot /www/http/site1.ru/html
    <IfModule mod_fcgid.c>
        SuexecUserGroup apache apache
        FcgidBusyTimeout 3600
        <Directory /www/http/site1.ru/html>
            DirectoryIndex index.php index.html
            Options FollowSymLinks
            Options +ExecCGI
            AllowOverride All
            AddHandler fcgid-script .php
            FCGIWrapper /www/cgi-bin/5.6.24-1.fcgi .php
            Require all granted
        </Directory>
    </IfModule>
ErrorLog /www/http/site1.ru/logs/error.log
CustomLog /www/http/site1.ru/logs/access.log common
</VirtualHost>


/www/cgi-bin/5.6.24-1.fcgi
#!/bin/bash
PHPRC="/www/http/site1.ru/php.ini"
PHP_FCGI_CHILDREN=4
# PHP_FCGI_MAX_REQUESTS=1000
export PHPRC
export PHP_FCGI_CHILDREN
export PHP_FCGI_MAX_REQUESTS
exec /opt/php/5.6.24-1/bin/php-cgi


/www/http/site1.ru/php.ini
date.timezone = "Europe/Moscow"
mbstring.func_overload = 2
mbstring.internal_encoding = "UTF-8"
memory_limit = 128M
file_uploads = On
max_input_time = 1500
max_execution_time = 1500
upload_max_filesize = 500M
post_max_size = 500M
max_input_vars = 10000
realpath_cache_size = 4096k
cgi.fix_pathinfo=1


# apachectl -M | grep fcgi
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message
 proxy_fcgi_module (shared)
 fcgid_module (shared)



В итоге - ошибка 500 при входе на http://site1.ru/ и в логах вот что:
[Thu Jul 13 22:25:29.368195 2017] [fcgid:warn] [pid 26347] (104)Connection reset by peer: [client 127.0.0.1:46452] mod_fcgid: error reading data from FastCGI server
[Thu Jul 13 22:25:29.368255 2017] [core:error] [pid 26347] [client 127.0.0.1:46452] End of script output before headers: index.php

p.s. права:

# ls -lat /www/http/
total 0
drwxrwxrwx. 5 apache apache 59 Jul 13 22:10 site1.ru
drwxrwxrwx. 3 root   root   22 Jul 13 20:31 .
drwxrwxrwx. 4 apache root   33 Jul 13 20:31 ..

# ls -lat /opt/php/
total 0
drwxr-xr-x. 6 apache apache 54 Jul 13 20:46 site1.ru
drwxr-xr-x. 4 root   root   38 Jul 13 20:43 .
drwxr-xr-x. 5 root   root   60 Jul 13 16:42 ..

Piter_prbg
() автор топика
Ответ на: комментарий от imul
# ls -latZ /www/http/
drwxrwxrwx. apache apache unconfined_u:object_r:default_t:s0 site1.ru
drwxrwxrwx. root   root   unconfined_u:object_r:default_t:s0 .
drwxrwxrwx. apache root   unconfined_u:object_r:default_t:s0 ..

# sestatus
SELinux status:                 enabled
SELinuxfs mount:                /sys/fs/selinux
SELinux root directory:         /etc/selinux
Loaded policy name:             targeted
Current mode:                   permissive
Mode from config file:          enforcing
Policy MLS status:              enabled
Policy deny_unknown status:     allowed
Max kernel policy version:      28

Piter_prbg
() автор топика
Ответ на: комментарий от Piter_prbg

Селинукс у тебя в пермиссив мод. Считай, что его итак нет, просто в логи пишет.
Меня враппер на баше смущает. Он точно передаёт php-cgi имя пхп скрипта?

imul ★★★★★
()
Ответ на: комментарий от imul

Как бы это проверить?

Если указать некорректный файл, то апач просто не стартанёт.

FCGIWrapper /www/cgi-bin/PRIVET.fcgi .php

так апач точно не стартует. а вот что там передаёт он или нет ... не знаю.

Piter_prbg
() автор топика
Ответ на: комментарий от Piter_prbg

p.s.

/etc/httpd/conf.d/fcgid.conf выглядит так:

# This is the Apache server configuration file for providing FastCGI support
# through mod_fcgid
#
# Documentation is available at
# http://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html

# Use FastCGI to process .fcg .fcgi & .fpl scripts
AddHandler fcgid-script fcg fcgi fpl

# Sane place to put sockets and shared memory file
FcgidIPCDir /run/mod_fcgid
FcgidProcessTableFile /run/mod_fcgid/fcgid_shm
PHP_Fix_Pathinfo_Enable 1

Piter_prbg
() автор топика
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.