我有 Apache 反向代理服务器,它将请求代理到我的内部 Apache 服务器。我在 Linux 平台上使用 Apache 2.4 版本。
每当后端 Apache 服务器花费超过 60 秒(PHP 页面等待后端 Apache 服务器上的 Mysql 查询结果)时,我就会遇到超时页面和 HTTP ERROR 504
Apache 默认超时设置为 300 秒。
仅当通过 apache 反向代理访问网站时才会出现此问题。使用内部 IP 效果很好。
我尝试将以下参数设置为 proxypass 但没有成功。
ProxyPass / http://internal-ip:8080/ retry=1 acquire=3000 timeout=600 Keepalive=On
Run Code Online (Sandbox Code Playgroud)
我还尝试在不存在的 IP 上进行 ProxyPass,60 秒后也显示 504 HTTP ERROR
请帮助我理解这个问题。
<VirtualHost *:80>
ServerName mywebsite.example.com
ServerAlias www.mywebsite.example.com
ProxyPreserveHost On
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/mywebsite.example.com-error.log
CustomLog ${APACHE_LOG_DIR}/mywebsite.example.com-access.log combined
RewriteCond %{REQUEST_METHOD} !^(GET|POST)$
RewriteRule .* - [R=405,L]
ProxyPass /.static-pages !
ProxyPass / http://<Internal Apache …
Run Code Online (Sandbox Code Playgroud)