使用 symfony 和 htaccess 与 php-fpm 的 SAFARI 错误白页在 chrome、IE、firefox 上均可运行

使用 symfony 和 htaccess 与 php-fpm 的 SAFARI 错误白页在 chrome、IE、firefox 上均可运行

我遇到了一个问题,我刚刚完成并上传了我的网站,但他无法与 safari 一起使用,出现白页,我检查了日志

[Thu May 16 07:56:17.534196 2019] [authz_core:debug] [pid 5671] mod_authz_core.c(820): [client 172.31.33.224:4894] AH01626: authorization result of Require all granted: granted
[Thu May 16 07:56:17.534240 2019] [authz_core:debug] [pid 5671] mod_authz_core.c(820): [client 172.31.33.224:4894] AH01626: authorization result of <RequireAny>: granted
[Thu May 16 07:56:17.534288 2019] [authz_core:debug] [pid 5671] mod_authz_core.c(820): [client 172.31.33.224:4894] AH01626: authorization result of Require all granted: granted
[Thu May 16 07:56:17.534293 2019] [authz_core:debug] [pid 5671] mod_authz_core.c(820): [client 172.31.33.224:4894] AH01626: authorization result of <RequireAny>: granted
[Thu May 16 07:56:17.534309 2019] [proxy:debug] [pid 5671] mod_proxy.c(1254): [client 172.31.33.224:4894] AH01143: Running scheme unix handler (attempt 0)
[Thu May 16 07:56:17.534315 2019] [proxy_ajp:debug] [pid 5671] mod_proxy_ajp.c(743): [client 172.31.33.224:4894] AH00894: declining URL fcgi://localhost/var/www/html/public/index.php
[Thu May 16 07:56:17.534318 2019] [proxy_fcgi:debug] [pid 5671] mod_proxy_fcgi.c(1021): [client 172.31.33.224:4894] AH01076: url: fcgi://localhost/var/www/html/public/index.php proxyname: (null) proxyport: 0
[Thu May 16 07:56:17.534322 2019] [proxy_fcgi:debug] [pid 5671] mod_proxy_fcgi.c(1028): [client 172.31.33.224:4894] AH01078: serving URL fcgi://localhost/var/www/html/public/index.php
[Thu May 16 07:56:17.534327 2019] [proxy:debug] [pid 5671] proxy_util.c(2326): AH00942: FCGI: has acquired connection for (*)
[Thu May 16 07:56:17.534343 2019] [proxy:debug] [pid 5671] proxy_util.c(2379): [client 172.31.33.224:4894] AH00944: connecting fcgi://localhost/var/www/html/public/index.php to localhost:8000
[Thu May 16 07:56:17.534347 2019] [proxy:debug] [pid 5671] proxy_util.c(2416): [client 172.31.33.224:4894] AH02545: fcgi: has determined UDS as /run/php-fpm/www.sock
[Thu May 16 07:56:17.534420 2019] [proxy:debug] [pid 5671] proxy_util.c(2588): [client 172.31.33.224:4894] AH00947: connected /var/www/html/public/index.php to httpd-UDS:0
[Thu May 16 07:56:17.534441 2019] [proxy:debug] [pid 5671] proxy_util.c(2959): AH02823: FCGI: connection established with Unix domain socket /run/php-fpm/www.sock (*)
[Thu May 16 07:56:17.638434 2019] [proxy:debug] [pid 5671] proxy_util.c(2341): AH00943: FCGI: has released connection for (*)

所以我在谷歌上搜索,发现问题是配置 vhost

我的初始虚拟主机如下所示:

<VirtualHost *:80>

ServerName mysite.com

   RewriteEngine On

   RewriteCond %{HTTP_HOST} !^www\. [NC]

   RewriteRule !/elbcheck.html https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

   RewriteCond %{HTTP:X-Forwarded-Proto} !https

   RewriteCond %{HTTPS} off

   RewriteRule !/elbcheck.html https://%{HTTP_HOST}%{REQUEST_URI} [L,R]

     DocumentRoot /var/www/html/public

    <Directory /var/www/html/public>

Require all granted

        AllowOverride None

        Order Allow,Deny

        Allow from All

FallbackResource /index.php

        <IfModule mod_rewrite.c>

            Options -MultiViews

            RewriteEngine On

            RewriteCond %{REQUEST_FILENAME} !-f

            RewriteRule ^(.*)$ index.php [QSA,L]

        </IfModule>

    </Directory>

    # uncomment the following lines if you install assets as symlinks

    # or run into problems when compiling LESS/Sass/CoffeeScript assets

    <Directory /var/www/html>

         Options FollowSymlinks

    </Directory>

    # optionally disable the RewriteEngine for the asset directories

    # which will allow apache to simply reply with a 404 when files are

    # not found instead of passing the request into the full symfony stack

    <Directory /var/www/html/public/bundles>

        FallbackResource disabled

    </Directory>

    ErrorLog /var/log/error-mysite-web.log

    LogLevel debug

    CustomLog /var/log/access-mysite-web.log combined

</VirtualHost>

我尝试改变:

<VirtualHost *:80>

ServerName mysite.com
ServerAlias www.mysite.com

   RewriteEngine On

   RewriteCond %{HTTP_HOST} !^www\. [NC]

   RewriteRule !/elbcheck.html https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

   RewriteCond %{HTTP:X-Forwarded-Proto} !https

   RewriteCond %{HTTPS} off

   RewriteRule !/elbcheck.html https://%{HTTP_HOST}%{REQUEST_URI} [L,R]


<FilesMatch \.php$>
        #SetHandler proxy:fcgi://127.0.0.1:9000
        # for Unix sockets, Apache 2.4.10 or higher
        SetHandler proxy:unix:/run/php-fpm/www.sock|fcgi://localhost
    </FilesMatch>

     DocumentRoot /var/www/html/public

    <Directory /var/www/html/public>

Require all granted

        AllowOverride None

        Order Allow,Deny

        Allow from All

FallbackResource /index.php

        <IfModule mod_rewrite.c>

            Options -MultiViews

            RewriteEngine On

            RewriteCond %{REQUEST_FILENAME} !-f

            RewriteRule ^(.*)$ index.php [QSA,L]

        </IfModule>

    </Directory>

    # uncomment the following lines if you install assets as symlinks

    # or run into problems when compiling LESS/Sass/CoffeeScript assets

    <Directory /var/www/html>

         Options FollowSymlinks

    </Directory>

    # optionally disable the RewriteEngine for the asset directories

    # which will allow apache to simply reply with a 404 when files are

    # not found instead of passing the request into the full symfony stack

    <Directory /var/www/html/public/bundles>

        FallbackResource disabled

    </Directory>

    ErrorLog /var/log/error-mysite-web.log

    LogLevel debug

    CustomLog /var/log/access-mysite-web.log combined

</VirtualHost>

但再次出现错误白页,现在

[Thu May 16 09:13:57.216483 2019] [authz_core:debug] [pid 9224] mod_authz_core.c(820): [client 172.31.22.222:57982] AH01626: authorization result of Require all granted: granted, referer: https://www.example.com/fr/
[Thu May 16 09:13:57.216532 2019] [authz_core:debug] [pid 9224] mod_authz_core.c(820): [client 172.31.22.222:57982] AH01626: authorization result of <RequireAny>: granted, referer: https://www.example.com/fr/
[Thu May 16 09:13:57.216599 2019] [authz_core:debug] [pid 9224] mod_authz_core.c(820): [client 172.31.22.222:57982] AH01626: authorization result of Require all granted: granted, referer: https://www.example.com/fr/
[Thu May 16 09:13:57.216604 2019] [authz_core:debug] [pid 9224] mod_authz_core.c(820): [client 172.31.22.222:57982] AH01626: authorization result of <RequireAny>: granted, referer: https://www.example.com/fr/
[Thu May 16 09:13:57.216622 2019] [proxy:debug] [pid 9224] mod_proxy.c(1254): [client 172.31.22.222:57982] AH01143: Running scheme unix handler (attempt 0), referer: https://www.example.com/fr/
[Thu May 16 09:13:57.216631 2019] [proxy_ajp:debug] [pid 9224] mod_proxy_ajp.c(743): [client 172.31.22.222:57982] AH00894: declining URL fcgi://localhost/var/www/html/public/index.php, referer: https://www.example.com/fr/
[Thu May 16 09:13:57.216639 2019] [proxy_fcgi:debug] [pid 9224] mod_proxy_fcgi.c(1021): [client 172.31.22.222:57982] AH01076: url: fcgi://localhost/var/www/html/public/index.php proxyname: (null) proxyport: 0, referer: https://www.example.com/fr/
[Thu May 16 09:13:57.216647 2019] [proxy_fcgi:debug] [pid 9224] mod_proxy_fcgi.c(1028): [client 172.31.22.222:57982] AH01078: serving URL fcgi://localhost/var/www/html/public/index.php, referer: https://www.example.com/fr/
[Thu May 16 09:13:57.216667 2019] [proxy:debug] [pid 9224] proxy_util.c(2326): AH00942: FCGI: has acquired connection for (*)
[Thu May 16 09:13:57.216672 2019] [proxy:debug] [pid 9224] proxy_util.c(2379): [client 172.31.22.222:57982] AH00944: connecting fcgi://localhost/var/www/html/public/index.php to localhost:8000, referer: https://www.example.com/fr/
[Thu May 16 09:13:57.216676 2019] [proxy:debug] [pid 9224] proxy_util.c(2416): [client 172.31.22.222:57982] AH02545: fcgi: has determined UDS as /run/php-fpm/www.sock, referer: https://www.example.com/fr/
[Thu May 16 09:13:57.216758 2019] [proxy:debug] [pid 9224] proxy_util.c(2588): [client 172.31.22.222:57982] AH00947: connected /var/www/html/public/index.php to httpd-UDS:0, referer: https://www.example.com/fr/
[Thu May 16 09:13:57.216792 2019] [proxy:debug] [pid 9224] proxy_util.c(2959): AH02823: FCGI: connection established with Unix domain socket /run/php-fpm/www.sock (*)
[Thu May 16 09:13:57.648620 2019] [proxy:debug] [pid 9224] proxy_util.c(2341): AH00943: FCGI: has released connection for (*)

我不明白我的 apache 版本是 2.4.39 和 php 7.2.16(fpm-cgi)

使用 conf fpm [www] 用户 = apache 组 = apache listen = /run/php-fpm/www.sock

你能帮助我吗谢谢

相关内容