Php

DNS 查找失敗:

  • November 19, 2018

我用 virtualmin 安裝了我的伺服器,我正在使用 apache 和 php fpm。當我嘗試打開我的網站時,出現此錯誤:

代理錯誤

代理伺服器收到來自上游伺服器的無效響應。代理伺服器無法處理請求 GET /index.php。

原因:DNS 查找失敗:

在“for:”之後是空的

這是我為該站點提供的 apache2 conf 文件:

<VirtualHost xx.xx.xx.xx:80>
SuexecUserGroup "#1005" "#1005"
ServerName test.fr
ServerAlias www.test.fr
ServerAlias mail.test.fr
ServerAlias webmail.test.fr
ServerAlias admin.test.fr
DocumentRoot /home/test/public_html
ErrorLog /var/log/virtualmin/test.fr_error_log
CustomLog /var/log/virtualmin/test.fr_access_log combined
ScriptAlias /cgi-bin/ /home/test/cgi-bin/
ScriptAlias /awstats/ /home/test/cgi-bin/
DirectoryIndex index.html index.htm index.php index.php4 index.php5
<Directory /home/test/public_html>
Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch +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/test/cgi-bin>
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
Require all granted
</Directory>
RewriteEngine on
RewriteCond %{HTTP_HOST} =webmail.test.fr
RewriteRule ^(.*) https://test.fr:20000/ [R]
RewriteCond %{HTTP_HOST} =admin.test.fr
RewriteRule ^(.*) https://test.fr:10000/ [R]
RemoveHandler .php
RemoveHandler .php7.0
<Files awstats.pl>
AuthName "test.fr statistics"
AuthType Basic
AuthUserFile /home/test/.awstats-htpasswd
require valid-user
</Files>
<FilesMatch \.php$>
#SetHandler proxy:fcgi://localhost:8000
SetHandler proxy:fcgi:///var/run/154262472926263.sock
</FilesMatch>
</VirtualHost>
<VirtualHost xx.xx.xx.xx:443>
SuexecUserGroup "#1005" "#1005"
ServerName test.fr
ServerAlias www.test.fr
ServerAlias mail.test.fr
ServerAlias webmail.test.fr
ServerAlias admin.test.fr
DocumentRoot /home/test/public_html
ErrorLog /var/log/virtualmin/test.fr_error_log
CustomLog /var/log/virtualmin/test.fr_access_log combined
ScriptAlias /cgi-bin/ /home/test/cgi-bin/
ScriptAlias /awstats/ /home/test/cgi-bin/
DirectoryIndex index.html index.htm index.php index.php4 index.php5
<Directory /home/test/public_html>
Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch +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/test/cgi-bin>
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
Require all granted
</Directory>
RewriteEngine on
RewriteCond %{HTTP_HOST} =webmail.test.fr
RewriteRule ^(.*) https://test.fr:20000/ [R]
RewriteCond %{HTTP_HOST} =admin.test.fr
RewriteRule ^(.*) https://test.fr:10000/ [R]
RemoveHandler .php
RemoveHandler .php7.0
SSLEngine on
SSLCertificateFile /home/test/ssl.cert
SSLCertificateKeyFile /home/test/ssl.key
SSLProtocol all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1
<Files awstats.pl>
AuthName "test.fr statistics"
AuthType Basic
AuthUserFile /home/test/.awstats-htpasswd
require valid-user
</Files>
<FilesMatch \.php$>
#SetHandler proxy:fcgi://localhost:8000
SetHandler proxy:fcgi:///var/run/154262472926263.sock
</FilesMatch>
</VirtualHost>

謝謝

SetHandler傳遞給 UNIX 域套接字的指令格式錯誤。

它應如文件所示:

SetHandler "proxy:unix:/var/run/154262472926263.sock|fcgi://localhost/"

請記住,您已將其放置在配置中的兩個位置。

另請記住,您可能還有其他配置問題,這些問題在這裡並不明顯。

引用自:https://serverfault.com/questions/940699