如何在没有 sock 文件的情况下解决 apache 2.4 上的 503 Service Unavailable?

如何在没有 sock 文件的情况下解决 apache 2.4 上的 503 Service Unavailable?

我对503 Service Unavailable问题日志的回顾是:

[proxy:error] (2)No such file or directory: AH02454: FCGI: attempt to connect
to Unix domain socket /usr/local/php72/sockets/admin.sock (*) failed
[proxy_fcgi:error]  AH01079: failed to make connect
ion to backend: httpd-UDS

但问题就在这里!我基本上没有admin.sock文件,而我的www.conf文件是:

listen = 127.0.0.1:9000

我该如何解决这个问题?其他详细信息:

httpd -v
Server version: Apache/2.4.37 (Unix)
Server built:   Dec  8 2018 14:57:21

Apache 配置:

    ServerRoot "/etc/httpd"
Listen 80
<IfModule unixd_module>
User apache
Group apache
</IfModule>
Include /etc/httpd/conf/extra/httpd-phpmodules.conf
ServerAdmin admin@localhost
DocumentRoot "/var/www/html"
<IfModule dir_module>
    DirectoryIndex index.html index.htm index.shtml index.php index.php5 index.php4 index.php3 index.phtml index.cgi index.pl
</IfModule>
<Files ".ht*">
    Require all denied
</Files>
<Files ".user.ini">
    Require all denied
</Files>
ErrorLog /var/log/httpd/error_log
LogLevel warn
<IfModule log_config_module>
    #replace %b with %O for more accurate logging
    <IfModule mod_logio.c>
      LogFormat "%a %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
      LogFormat "%a %l %u %t \"%r\" %>s %O" common
      LogFormat "%O %I" bytes
      LogFormat "%a %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
    </IfModule>
    CustomLog /var/log/httpd/access_log common
</IfModule>
<IfModule alias_module>
    Include conf/extra/httpd-alias.conf
</IfModule>
<IfModule mime_module>
    TypesConfig conf/mime.types
    AddType application/x-gzip .tgz
    AddEncoding x-compress .Z
    AddEncoding x-gzip .gz .tgz
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
    AddHandler cgi-script .cgi
    AddHandler type-map var
    AddType text/html .shtml
    AddOutputFilter INCLUDES .shtml
        AddType video/x-ms-asf .avi
        AddType video/mpeg .mpg
        AddType video/mpeg .mpeg
        AddType video/quicktime .mov
        AddType video/x-ms-wmv .wmv
</IfModule>
Include conf/extra/httpd-includes.conf
Include conf/extra/httpd-directories.conf
Include conf/extra/httpd-nginx.conf
Include conf/extra/httpd-mpm.conf
Include conf/extra/httpd-multilang-errordoc.conf
Include conf/extra/httpd-autoindex.conf
Include conf/extra/httpd-languages.conf
Include conf/extra/httpd-info.conf
Include conf/extra/httpd-suphp.conf
Include conf/extra/httpd-dav.conf
Include conf/extra/httpd-default.conf
Include conf/extra/httpd-ssl.conf
Include conf/extra/httpd-deflate.conf
Include conf/extra/httpd-php-handlers.conf
Include conf/extra/httpd-vhosts.conf
Include conf/extra/directadmin-vhosts.conf
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>

Apache 虚拟主机设置:

<Directory "/home/admin/public_html">
                <FilesMatch "\.(inc|php|phtml|phps|php72)$">
                        AddHandler "proxy:unix:/usr/local/php72/sockets/admin.sock|fcgi://localhost" .inc .php .phtml .php72
                </FilesMatch>
        <IfModule mod_fcgid.c>
                SuexecUserGroup admin admin
        </IfModule>
</Directory>

<VirtualHost *:80 >
        ServerName www.test.com
        ServerAlias www.test.com test.com
        ServerAdmin [email protected]
        DocumentRoot /home/admin/domains/test.com/public_html
        ScriptAlias /cgi-bin/ /home/admin/domains/test.com/public_html/cgi-bin/
        UseCanonicalName OFF
        <IfModule !mod_ruid2.c>
                SuexecUserGroup admin admin
        </IfModule>
        CustomLog /var/log/httpd/domains/test.com.bytes bytes
        CustomLog /var/log/httpd/domains/test.com.log combined
        ErrorLog /var/log/httpd/domains/test.com.error.log
        <Directory /home/admin/domains/test.com/public_html>
                <FilesMatch "\.(inc|php|phtml|phps|php72)$">
                        ProxyErrorOverride on
                        AddHandler "proxy:unix:/usr/local/php72/sockets/admin.sock|fcgi://localhost" .inc .php .phtml .php72
                </FilesMatch>
        </Directory>
</VirtualHost>

答案1

我发现我更改了我的 php-fpm 处理程序并使用 127.0.0.1 代替它。像 nginx 设置 apache 一样,需要为虚拟域设置中的任何域更改 php-fpm 处理程序,感谢 Michael Hampton 帮助我找到这个问题

相关内容