How can I limit user connection to the server?

Discussion in 'Apache' started by Barti1987, Apr 19, 2007.

  1. #1
    How can I limit user connection to the server to 1.

    So a person can access 1 file (connection) at a time.

    Fedora on HTTP 1.3

    Thanks,
     
    Barti1987, Apr 19, 2007 IP
  2. rootbinbash

    rootbinbash Peon

    Messages:
    2,198
    Likes Received:
    88
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You can do it via iptables.You can only limit request times per sec/min/hr .for example you can make a rule like "120 http requests per 10 secs" . Thats all you can do at server side(if you want to do this because of bandwith,you can limit it per ip or connection).Tho you can make a script which checks if connection is still alive and deny the file request or something like that.

    Thats what i know,maybe i am wrong
     
    rootbinbash, Apr 19, 2007 IP
  3. Barti1987

    Barti1987 Well-Known Member

    Messages:
    2,703
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    185
    #3
    I'll try that. Currently I am trying mod_limitipconn.so, but having trouble fixing it, the code I am using:

    
    LoadModule limitipconn_module /usr/lib/apache/mod_limitipconn.so
    AddModule mod_limitipconn.c
    <IfModule mod_limitipconn.c>
        <Location />
            MaxConnPerIP 1
        </Location>
    </IfModule>
    
    Code (markup):
    Peace,
     
    Barti1987, Apr 19, 2007 IP
  4. rootbinbash

    rootbinbash Peon

    Messages:
    2,198
    Likes Received:
    88
    Best Answers:
    0
    Trophy Points:
    0
    #4
    ok i never used that but i tried it at my notebook for 4-5 mins

    Are you going to limit whole root folder(because your setting is limiting all folders)? Please send me(pm me the download link) your httpd.conf and include which folder and domain you want to limit , i will check the config and fix the error.I can't say anything without checking whole httpd.conf
     
    rootbinbash, Apr 19, 2007 IP
    Barti1987 likes this.
  5. Barti1987

    Barti1987 Well-Known Member

    Messages:
    2,703
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    185
    #5
    Thanks for the help rootbinbash, here is what was wrong:

    1) The code should've been within the <VirtualHost IP:80> </VirtualHost> tags.
    2) The following must be uncommented (default is commented):
    
    ExtendedStatus On
    <Location /httpd-status>
    SetHandler server-status
    </Location>
    
    Code (markup):
    3) Before you Make the script, you need to edit APSX variable in "Makefile" file to reflect the path of your aspx file.

    Thats it, everyone should work fine.

    Also I created a custom 503 page to make it look "nice".

    Peace,
     
    Barti1987, Apr 20, 2007 IP