@Coraelstraze

Internal Server error 500 при подключении mod_fcgid на Apache CentOS 7?

Есть сервер на VirtualBox на CentOS 7. Связка Nginx+Apache (где nginx как фронтенд, а апач как бэкенд).
Т.к. с динамикой у меня работает apache, я так понял что мне нужно fastcgi подключать к нему.

Стоит PHP 7. Просто в режиме mod_php сайты работают.

1. Подключил модуль mod_fcgid (необходимый LoadModule есть в httpd.conf)
2. В 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

DirectoryIndex index.php

FcgidFixPathinfo 1
FcgidMaxRequestsPerProcess 10000


3. В php.ini раскомментировал:

cgi.fix_pathinfo=1

4. Создал директорию /var/www/php-cgi (сайты находятся в /var/www/daniel/site1.ru/public_html....). В ней файл php.fcgi со следующим содержанием:

#!/bin/sh
PHP_FCGI_MAX_REQUESTS=10000
export PHP_FCGI_MAX_REQUESTS
exec /usr/bin/php-cgi


5. Файл site2.ru.conf содержит:

<VirtualHost *:8080>
ServerName site2.ru
ServerAlias www.site2.ru
DocumentRoot /var/www/daniel/site2.ru/public_html
ErrorLog /var/log/httpd/site2_ru_error.log
CustomLog /var/log/httpd/site2_ru_requests.log combined
SuexecUserGroup daniel daniel

<IfModule mod_fcgid.c>
FcgidBusyTimeout 3600
</IfModule>

<Directory "/var/www/daniel/site2.ru/public_html">
Options +ExecCGI
AddHandler fcgid-script .php
FcgiWrapper /var/www/php-cgi/php.fcgi .php
AllowOverride All
Order allow,deny
Allow from all
</Directory>

</VirtualHost>


6. Права у меня следующие: apache работает под daniel:daniel и вся директория /var/www/ рекурсивно тоже.
Директории /var/www/php-cgi вообще дал 777 в итоге, потому что гуглил, что бывает из-за этих прав ошибка.

Сначала у меня была ошибка с Permissions, я поставил в /run/mod_fcgid/ пользователя daniel:daniel и дал права 755.

Ошибка с permissions исчезла, но теперь появилась самая главная ошибка, на которой застрял.

При переходе на сайт у меня Internal Server Error 500.
Ошибки нашел только в логах /var/log/httpd/site2_ru_error.log.

[Wed May 08 01:47:21.480618 2019] [fcgid:warn] [pid 32082] (104)Connection reset by peer: [client 127.0.0.1:52274] mod_fcgid: error reading data from FastCGI server
[Wed May 08 01:47:21.480722 2019] [core:error] [pid 32082] [client 127.0.0.1:52274] End of script output before headers: index.php


В php.ini и в fcgid.conf пробовал увеличивать объем памяти и время ожидания. Тщетно.

Нужна помощь!
  • Вопрос задан
  • 1038 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы