Release time:2020-09-30 16:35:08 Views:18654
at a certain date,The background developer in the group found me,Ask usWEBWhat is the server timeout setting。His feedback question is,There is oneVLANSwitch TaskscgiThe interface often returns504Gateway timeout error,Let me analyze and solve it。
I asked,It is known that this request encounters many network device objects,It takes less than half an hour to complete,That is, long connections are needed。
Old rules,Get the interface address from the developer,Get access layer serverIP,It's aHaproxyagent,Have a lookHaproxyTimeout settings for:
# Set the maximum waiting time for a successful connection to a server,The default unit is milliseconds,New versionhaproxyusetimeout connectreplace,This parameter is backward compatiblecontimeout 3600# Set the maximum waiting time for a successful connection when connecting clients to send data,The default unit is milliseconds,New versionhaproxyusetimeout clientreplace。This parameter is backward compatibleclitimeout 3600# Set the maximum waiting time for the server to respond to client data sending,The default unit is milliseconds,New versionhaproxyusetimeout serverreplace。This parameter is backward compatiblesrvtimeout 3600
various1Hour timeout,So excludeHaproxyImpact of,Keep looking down。
Haproxy The agent is2platformApache,That is, deploymentcgiServer of the interface。The first time I checked httpd.conf and httpd-vhost.conf Configuration in,Couldn't find the timeout setting。
therefore,Searched the following related tutorials,Found it was hidden in httpd-default.conf among:
## This configuration file reflects default settings for Apache HTTP Server.## You may change these, but chances are that you may not need to.### Timeout: The number of seconds before receives and sends time out.#Timeout 300## KeepAlive: Whether or not to allow persistent connections (more than# one request per connection). Set to "Off" to deactivate.#KeepAlive On## MaxKeepAliveRequests: The maximum number of requests to allow# during a persistent connection. Set to 0 to allow an unlimited amount.# We recommend you leave this number high, for maximum performance.#MaxKeepAliveRequests 100## KeepAliveTimeout: Number of seconds to wait for the next request from the# same client on the same connection.#KeepAliveTimeout 5## UseCanonicalName: Determines how Apache constructs self-referencing # URLs and the SERVER_NAME and SERVER_PORT variables.# When set "Off", Apache will use the Hostname and Port supplied# by the client. When set "On", Apache will use the value of the# ServerName directive.#UseCanonicalName Off## AccessFileName: The name of the file to look for in each directory# for additional configuration directives. See also the AllowOverride # directive.#AccessFileName .htaccess## ServerTokens# This directive configures what you return as the Server HTTP response# Header. The default is 'Full' which sends information about the OS-Type# and compiled in modules.# Set to one of: Full | OS | Minor | Minimal | Major | Prod# where Full conveys the most information, and Prod the least.#ServerTokens Full## Optionally add a line containing the server version and virtual host# name to server-generated pages (internal error documents, FTP directory # listings, mod_status and mod_info output etc., but not CGI generated # documents or custom error documents).# Set to "EMail" to also include a mailto: link to the ServerAdmin.# Set to one of: On | Off | EMail#ServerSignature On## HostnameLookups: Log the names of clients or just their IP addresses# e.g., www.apache.org (on) or 204.62.129.132 (off).# The default is off because it'd be overall better for the net if people# had to knowingly turn this feature on, since enabling it means that# each client request will result in AT LEAST one lookup request to the# nameserver.#HostnameLookups Off
Have a look,These areApacheDefault configuration for,Apacheeitherincludereachhttpd.confamong。therefore,edit httpd.conf,Find the following parameters:
#Include conf/extra/httpd-default.conf
Remove comments,Save File。Then edit /usr/local/apache2/conf/extra/httpd-default.conf file,takeTimeoutThe value of is modified to meet the requirements of the production environment1800second,Final executionApacheSmooth restart command:
/usr/local/apache2/bin/apachectl -k gracefulperhaps/usr/local/apache2/bin/httpd -k graceful
Ps:I always thought that onlyNginxThere is a smoothreloadcommand,I'll find out laterApache、HaproxyBoth support smooth restart names,This is great!
After reloading,Will not appear504Gateway timeout is set。
Things go around the world
Multi warehouse direct delivery Fast delivery, multi warehouse direct delivery Extreme speed matching
Exquisite service
Exquisite service After sales guarantee and refined service After sales guarantee
Return and exchange worry free
Shopping with confidence Return to worry free shopping Return without worry
Full reduction activity
full500Yuan Lijian90,New user reduction200
Open WeChat,Click on the bottom“find”
use“scan”You can share the webpage to your friends