AH01071: Произошла ошибка 'Основной сценарий неизвестен

Debian Linux 8.10, Apache версия 2.4.10, FPM/FastCGI.

Я создал 1-й виртуальный хост. После нескольких часов я мог заставить его работать. Затем я создал еще один виртуальный хост с почти такой же конфигурацией => Я получил "Файл не найден". в браузере и 404.

Посмотрите на журнал ошибок Apache:

AH01071: Got error 'Primary script unknown' 

Я сравнил файлы конфигурации бок о бок с работающим vhost, и я не вижу существенных отличий.

/etc/php5/fpm/pool.d/152.......94.conf

[152........94]
user = vhostthatNOTworks
group = vhostthatNOTworks
listen = 8002
pm = dynamic
pm.max_children = 9999
pm.start_servers = 1
pm.min_spare_servers = 1
pm.max_spare_servers = 5
php_admin_value[upload_tmp_dir] = /home/vhostthatNOTworks/tmp
php_admin_value[session.save_path] = /home/vhostthatNOTworks/tmp

Кроме как на рабочем vhost: listen = 8000

На плохой вхсот: listen = 8002

Это значение было установлено virtualmin. Я не знаю, почему есть разница, и если это имеет значение?

/etc/apache2/apache2.conf (комментарии удалены):

Mutex file:${APACHE_LOCK_DIR} default
PidFile ${APACHE_PID_FILE}
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}
HostnameLookups Off
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf
Include ports.conf

<Directory />
    Options FollowSymLinks
    AllowOverride None
    Require all denied
</Directory>

<Directory /usr/share>
    AllowOverride None
    Require all granted
</Directory>

<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>

AccessFileName .htaccess

<FilesMatch "^\.ht">
    Require all denied
</FilesMatch>

LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

IncludeOptional conf-enabled/*.conf
IncludeOptional sites-enabled/*.conf

.conf of vhost, который работает:

<VirtualHost 188.165.53.208:80>
SuexecUserGroup vhostthatworks vhostthatworks
ServerName vhostthatworks.fr
ServerAlias www.vhostthatworks.fr
ServerAlias webmail.vhostthatworks.fr
ServerAlias admin.vhostthatworks.fr
DocumentRoot /home/spip31/public_html
ErrorLog /var/log/virtualmin/vhostthatworks.fr_error_log
CustomLog /var/log/virtualmin/vhostthatworks.fr_access_log combined
ScriptAlias /cgi-bin/ /home/vhostthatworks/cgi-bin/
DirectoryIndex index.html index.htm index.php index.php4 index.php5
<Directory /home/spip31/public_html>
Options -Indexes +IncludesNOEXEC +FollowSymLinks +ExecCGI
allow from all
AllowOverride All     Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
AddType application/x-httpd-php .php
</Directory>
<Directory /home/vhostthatworks/cgi-bin>
allow from all
AllowOverride All         Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
Require all granted
</Directory>
RewriteEngine on
RewriteCond %{HTTP_HOST} =webmail.vhostthatworks.fr
RewriteRule ^(.*) https://vhostthatworks.fr:20000/ [R]
RewriteCond %{HTTP_HOST} =admin.vhostthatworks.fr
RewriteRule ^(.*) https://vhostthatworks.fr:10000/ [R]
RemoveHandler .php
RemoveHandler .php5
php_admin_value engine Off
<FilesMatch \.php$>
SetHandler proxy:fcgi://localhost:8000
</FilesMatch>
</VirtualHost>
<VirtualHost 188.165.53.208:443>
SuexecUserGroup vhostthatworks vhostthatworks
ServerName vhostthatworks.fr
ServerAlias www.vhostthatworks.fr
ServerAlias webmail.vhostthatworks.fr
ServerAlias admin.vhostthatworks.fr
DocumentRoot /home/spip31/public_html
ErrorLog /var/log/virtualmin/vhostthatworks.fr_error_log
CustomLog /var/log/virtualmin/vhostthatworks.fr_access_log combined
ScriptAlias /cgi-bin/ /home/vhostthatworks/cgi-bin/
DirectoryIndex index.html index.htm index.php index.php4 index.php5
<Directory /home/spip31/public_html>
Options -Indexes +IncludesNOEXEC +FollowSymLinks +ExecCGI
allow from all
AllowOverride All     Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
Require all granted
AddType application/x-httpd-php .php
</Directory>
<Directory /home/vhostthatworks/cgi-bin>
allow from all
AllowOverride All     Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
Require all granted
</Directory>
RewriteEngine on
RewriteCond %{HTTP_HOST} =webmail.vhostthatworks.fr
RewriteRule ^(.*) https://vhostthatworks.fr:20000/ [R]
RewriteCond %{HTTP_HOST} =admin.vhostthatworks.fr
RewriteRule ^(.*) https://vhostthatworks.fr:10000/ [R]
RemoveHandler .php
RemoveHandler .php5
php_admin_value engine Off
SSLEngine on
SSLCertificateFile /home/bilp/SSL/domain.crt
SSLCertificateKeyFile /home/bilp/SSL/domain.key
SSLCertificateChainFile /home/bilp/SSL/intermediate.pem
SSLCACertificateFile /home/bilp/SSL/root.cer
SSLProtocol all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1
<Directory /home/vhostthatworks/public_html>
Options +Indexes +IncludesNOEXEC +SymLinksifOwnerMatch +ExecCGI
allow from all
AllowOverride All     Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
AddType application/x-httpd-php .php
</Directory>
<FilesMatch \.php$>
SetHandler proxy:fcgi://localhost:8000
</FilesMatch>
</VirtualHost>

.conf of vhost, который НЕ работает:

<VirtualHost *:80>
SuexecUserGroup "#1003" "#1003"
ServerName vhostthatNOTworks.fr
ServerAlias www.vhostthatNOTworks.fr
ServerAlias webmail.vhostthatNOTworks.fr
ServerAlias admin.vhostthatNOTworks.fr
DocumentRoot /home/spip31/public_html
ErrorLog /var/log/virtualmin/vhostthatNOTworks.fr_error_log
CustomLog /var/log/virtualmin/vhostthatNOTworks.fr_access_log combined
ScriptAlias /cgi-bin/ /home/vhostthatNOTworks/cgi-bin/
DirectoryIndex index.html index.htm index.php index.php4 index.php5
<Directory /home/spip31/public_html>
Options -Indexes +IncludesNOEXEC +FollowSymLinks +ExecCGI
allow from all
AllowOverride All     Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
Require all granted
AddType application/x-httpd-php .php
</Directory>
<Directory /home/vhostthatNOTworks/cgi-bin>
allow from all
AllowOverride All     Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
Require all granted
</Directory>
RewriteEngine on
RewriteCond %{HTTP_HOST} =webmail.vhostthatNOTworks.fr
RewriteRule ^(.*) https://vhostthatNOTworks.fr:20000/ [R]
RewriteCond %{HTTP_HOST} =admin.vhostthatNOTworks.fr
RewriteRule ^(.*) https://vhostthatNOTworks.fr:10000/ [R]
AddType application/x-httpd-php .php
AddType application/x-httpd-php5.6 .php5.6
<Directory /home/vhostthatNOTworks/public_html>
Options +Indexes +SymLinksifOwnerMatch +ExecCGI
allow from all
AllowOverride All     Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
AddType application/x-httpd-php .php
</Directory>
RemoveHandler .php
RemoveHandler .php5
php_admin_value engine Off
<FilesMatch \.php$>
SetHandler proxy:fcgi://localhost:8002
</FilesMatch>
</VirtualHost>
<VirtualHost 188.165.253.141:443>
SuexecUserGroup "#1003" "#1003"
ServerName vhostthatNOTworks.fr
ServerAlias www.vhostthatNOTworks.fr
ServerAlias webmail.vhostthatNOTworks.fr
ServerAlias admin.vhostthatNOTworks.fr
DocumentRoot /home/spip31/public_html
ErrorLog /var/log/virtualmin/vhostthatNOTworks.fr_error_log
CustomLog /var/log/virtualmin/vhostthatNOTworks.fr_access_log combined
ScriptAlias /cgi-bin/ /home/vhostthatNOTworks/cgi-bin/
DirectoryIndex index.html index.htm index.php index.php4 index.php5
<Directory /home/spip31/public_html>
Options -Indexes +IncludesNOEXEC +FollowSymLinks +ExecCGI
allow from all
AllowOverride All     Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
Require all granted
AddType application/x-httpd-php .php
</Directory>
<Directory /home/vhostthatNOTworks/cgi-bin>
allow from all
AllowOverride All     Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
Require all granted
</Directory>
RewriteEngine on
RewriteCond %{HTTP_HOST} =webmail.vhostthatNOTworks.fr
RewriteRule ^(.*) https://vhostthatNOTworks.fr:20000/ [R]
RewriteCond %{HTTP_HOST} =admin.vhostthatNOTworks.fr
RewriteRule ^(.*) https://vhostthatNOTworks.fr:10000/ [R]
RemoveHandler .php
RemoveHandler .php5
php_admin_value engine Off
SSLEngine on
SSLCertificateFile /home/bilp/SSL/domain.crt
SSLCertificateKeyFile /home/bilp/SSL/domain.key
SSLCertificateChainFile /home/bilp/SSL/intermediate.pem
SSLCACertificateFile /home/bilp/SSL/root.cer
<Directory /home/gloriette_bilp/public_html>
Options +Indexes +IncludesNOEXEC +SymLinksifOwnerMatch +ExecCGI
allow from all
AllowOverride All     Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
AddType application/x-httpd-php .php
</Directory>
<FilesMatch \.php$>
SetHandler proxy:fcgi://localhost:8002
</FilesMatch>
</VirtualHost>

Очевидно, PHP-FPM прослушивает порты (8000 для vhostthatNOTworks и 8002 для vhostthatNOTworks): netstat -ltnp

tcp        0      0 0.0.0.0:8001            0.0.0.0:*               LISTEN      2308/php-fpm.conf)
tcp        0      0 0.0.0.0:8002            0.0.0.0:*               LISTEN      2308/php-fpm.conf)

Кто-нибудь может мне помочь?

2 ответа

Это глупо. Я думаю, что эта ошибка скорее связана с VirtualMin, чем Apache2. Перезагрузка была все что мне нужно. Перезапуск Apache2 не работает. Должно быть что-то о том, как VirtualMin обрабатывает Apache2.

Источник: [решено] AH01071: Произошла ошибка "Основной сценарий неизвестен \n"

Я перезагрузил сервер, и он работает.

Спасибо Лукасу и Джерарду за помощь.

Другие вопросы по тегам