Apache uses the Limit module to limit the number of IP connections

Source: Internet
Author: User
Tags bz2

System version: centos6.3

Apache version: apache2.42 (compile-install)

1. Configure the Limit module

#wget http://dominia.org/djao/limit/mod_limitipconn-0.24.tar.bz2

Installation:

#tar JXVF mod_limitipconn-0.24.tar.bz2

#cd mod_limitipconn-0.24

#vi Makefile

Find Apxs, change it.

Apxs=/usr/local/apache2/bin/apxs

#make && make Install

Examples of global variables:

< Ifmodule mod_limitipconn.c >

< Location/> # All Virtual Host/directory

Maxconnperip 3 # Only 3 concurrent connections per IP allowed

Noiplimit image/* # Don't make IP restrictions on pictures

</location >

< Location/mp3 > #/mp3 directory for all hosts

Maxconnperip 1 # Only one connection request per IP allowed

Onlyiplimit audio/mpeg Video # This limit is only for videos and audio format files

</location >

</ifmodule >

# vi/usr/local/apache2/conf/httpd.conf

--------------------

Extendedstatus on

LoadModule Limitipconn_module modules/mod_limitipconn.so

<ifmodule mod_limitipconn.c>

<location/>

Maxconnperip 6

Noiplimit image/*

</Location>

</IfModule>

-------------------

2, the configuration Webbench the website to carry on the pressure test:

#wget http://blog.s135.com/soft/linux/webbench/webbench-1.5.tar.gz

#tar ZXVF webbench-1.5.tar.gz

#cd webbench-1.5

#make && make Install

3. Use:

Webbench-c 500-t HTTP://127.0.0.1/

Parameter Description:-C Indicates the number of concurrent,-T represents time (seconds)

4. Sample test results:

Webbench-simple Web Benchmark 1.5

Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.

Benchmarking:get HTTP://127.0.0.1/

Clients, running Sec.

speed=3230 pages/min, 11614212 bytes/sec.

requests:1615 susceed, 0 failed.

This article comes from "All the Way North" blog, please be sure to keep this source http://showerlee.blog.51cto.com/2047005/1165374

See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/Servers/web/

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.