Prevent DoS attacks on Apache servers

Source: Internet
Author: User


Apache server's defense against DoS attacks is mainly implemented through the Apache DoS Evasive Maneuvers Module.

It is an alternative to mod_access and can defend against DoS attacks. The software can quickly reject repeated requests from the same address to the same URL by querying a hash table of each sub-process.

Download the software at http://online.securityfocus.com/data/tools/dospatch.tar.gz.

For software installation configurations, you can view the apacheability and security features on the Linux homepage http://www.linux.gov.cn/. the procedure is relatively simple and is not described here.
At the same time, you can use powerful commands in Linux to prevent Dos attacks.

Netstat-an | grep-I "Server IP Address: 80" | awk '{print $6}' | sort | uniq-c | sort-n


This command will automatically count the number of TCP connections in various States. If syn_recv is very high, the possibility of TCP-based Denial of Service attacks cannot be ruled out. Therefore, you need to enable tcp_syncookies:

Echo 1>/proc/sys/net/ipv4/tcp_syncookies


If no/proc/sys/net/ipv4/tcp_syncookies are available, the kernel does not support syncookies. You need to recompile the kernel and reduce the number of SYN retries.

Echo "1">/proc/sys/net/ipv4/tcp_syn_retriesecho "1">/proc/sys/net/ipv4/tcp_synack_retries


At the same time, increase syn_backlog to ensure user access:

Echo "2048">/proc/sys/net/ipv4/tcp_max_syn_backlog

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.