apache2 - 在启用站点的 xml 配置中设置超时

apache2 - set timeout in xml configuration of sites-enabled

我使用下面的配置,以便通过 SSL 访问我的应用程序。 我现在的问题是如何将超时设置为 **。 有没有办法做到这一点,语法如何?

# force HTTPS
<VirtualHost *:80>
ServerName app.xy.at

RewriteEngine on
RewriteCond %{SERVER_NAME} =app.xy.at
Redirect permanent "/" https://app.xy.at
RewriteRule (.*) https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

# forward ORDS requests to tomcat
<VirtualHost *:443>
ServerName app.xy.at

# SSL certificates settings
#Include /etc/apache2/conf-enabled/options-ssl-apache.conf
SSLCertificateFile /etc/apache2/ssl/app.xy.at/fullchain.cer
SSLCertificateKeyFile /etc/apache2/ssl/app.xy.at/app.xy.at.key
SSLCertificateChainFile /etc/apache2/ssl/app.xy.at/ca.cer

ProxyRequests on
ProxyPreserveHost On
<Location / >
    ProxyPass "ajp://localhost:9090/"
    ProxyPassReverse "ajp://localhost:9090/"
</Location>

我将设置超时,因为我收到以下错误:

[Thu Mar 26 00:10:52.731383 2020] [proxy_ajp:error] [pid 16266:tid 
139926293157632] [client 
xxx.xxx.3.59:60869] AH00893: dialog to 127.0.0.1:9090 (localhost) 
failed, referer: 
https domain
[Thu Mar 26 00:10:57.802571 2020] [proxy_ajp:error] [pid 16266:tid 
139926720988928] 
(70014)End of file found: AH01030: ajp_ilink_receive() can't receive 
header
[Thu Mar 26 00:10:57.802597 2020] [proxy_ajp:error] [pid 16266:tid 
139926720988928] [client 
xxx.xxx.3.59:60875] AH00992: ajp_read_header: ajp_ilink_receive 
failed, referer: 
https domain
[Thu Mar 26 00:10:57.802628 2020] [proxy_ajp:error] [pid 16266:tid 
139926720988928] 
(120006)APR does not understand this error code: [client 
xxxx.xxxx.3.59:60875] AH00878: read 
response failed from 127.0.0.1:9090 (localhost), referer: https domain

我也不知道为什么。

根据documentation,可以随URL传递不同的参数,格式为键值对

ProxyPass "protocol://domain.com" key1=value1 key2=value2 ...

对于你的情况,

ProxyPass "ajp://localhost:9090/" connectiontimeout=10 timeout=50

connectiontimeout : Connect timeout in seconds. The number of seconds Apache httpd waits for the creation of a connection to the backend to complete. By adding a postfix of ms, the timeout can be also set in milliseconds.

timeout : Connection timeout in seconds. The number of seconds Apache httpd waits for data sent by / to the backend.