How to enable DDoS protection?

前端 未结 10 1225
天命终不由人
天命终不由人 2020-11-29 15:04

DDoS (Distributed Denial of Service Attacks) are generally blocked on a server level right?

Is there a way to block it on a PHP level, or at least reduce it?

10条回答
  •  臣服心动
    2020-11-29 15:31

    DDOS are generally blocked on a server level, Please enable DDOS protection in your Server Level. Please check the below notes for DDOS protections.

    Apache HTTP Server configuration settings that can help prevent DDOS problems:

    The RequestReadTimeout directive allows to limit the time a client may take to send the request.

    Allow 10 seconds to receive the request including the headers and 30 seconds for receiving the request body:

    RequestReadTimeout header=10 body=30
    

    Allow at least 10 seconds to receive the request body. If the client sends data, increase the timeout by 1 second for every 1000 bytes received, with no upper limit for the timeout (except for the limit given indirectly by LimitRequestBody):

    RequestReadTimeout body=10,MinRate=1000
    
    RequestReadTimeout header=10-30,MinRate=500
    RequestReadTimeout header=20-40,MinRate=500 body=20,MinRate=500
    

    The KeepAliveTimeout directive may be also lowered on sites that are subject to DoS attacks. Some sites even turn off the keepalives completely via KeepAlive, which has of course other drawbacks on performance. The values of various timeout-related directives provided by other modules should be checked.

    The directives LimitRequestBody, LimitRequestFields, LimitRequestFieldSize, LimitRequestLine, and LimitXMLRequestBody should be carefully configured to limit resource consumption triggered by client input. Tune the MaxRequestWorkers directive to allow the server to handle the maximum number of simultaneous connections without running out of resources.

提交回复
热议问题