Results 1 to 6 of 6

Thread: vbulletin fix for apache + nginx

  1. #1
    Administrator GumSlone's Avatar
    Join Date
    Mar 2005
    Location
    Mars, GumCity
    Posts
    1,494
    Thanks
    125
    Thanked 573 Times in 201 Posts
    Blog Entries
    2
    Rep Power
    10

    Default vbulletin fix for apache + nginx

    Here is a fix for vbulleting forum sites which have installed apache with nginx proxy on the server,

    without this fix all users of the site will have the same ip (the ip of the server the site installed at)

    the problem can appear if you set timeout limit of 15 minutes after several login fails, this will cause that users who login with correct username and password will receive an error message like: You have used up your failed login quota! Please wait 15 minutes before trying again.

    so here is a fix:

    open includes/class_core.php with your editor and replace functions fetch_ip()
    and fetch_alt_ip()

    by this:

    PHP Code:
    function fetch_ip()
        {
            if(isset(
    $_SERVER["HTTP_X_REAL_IP"]))return $_SERVER["HTTP_X_REAL_IP"];        
            else return 
    $_SERVER['REMOTE_ADDR'];
        }
        
    function 
    fetch_alt_ip()
        {
            if(isset(
    $_SERVER["HTTP_X_REAL_IP"]))$alt_ip =  $_SERVER["HTTP_X_REAL_IP"];        
            else 
    $alt_ip =  $_SERVER['REMOTE_ADDR'];        #$alt_ip = $_SERVER['REMOTE_ADDR'];

            
    if (isset($_SERVER['HTTP_CLIENT_IP']))
            {
                
    $alt_ip $_SERVER['HTTP_CLIENT_IP'];
            }
            else if (isset(
    $_SERVER['HTTP_X_FORWARDED_FOR']) AND preg_match_all('#\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}#s'$_SERVER['HTTP_X_FORWARDED_FOR'], $matches))
            {
                
    // make sure we dont pick up an internal IP defined by RFC1918
                
    foreach ($matches[0] AS $ip)
                {
                    if (!
    preg_match('#^(10|172\.16|192\.168)\.#'$ip))
                    {
                        
    $alt_ip $ip;
                        break;
                    }
                }
            }
            else if (isset(
    $_SERVER['HTTP_FROM']))
            {
                
    $alt_ip $_SERVER['HTTP_FROM'];
            }

            return 
    $alt_ip;
        } 

    i have simpy added the $_SERVER["HTTP_X_REAL_IP"] to both functions because thi is the enviroment variable which shows the correct user ip in nginx

    after i fixed mine i found a similar article here: [Only registered and activated users can see links. Click Here To Register...]
    Advertise your mobile site for FREE with [Only registered and activated users can see links. Click Here To Register...]

    [Only registered and activated users can see links. Click Here To Register...]


  2. #2
    Moderator Anshul's Avatar
    Join Date
    Jun 2007
    Location
    India
    Posts
    296
    Thanks
    5
    Thanked 19 Times in 15 Posts
    Rep Power
    0

    Default

    You can use $http_remote_addr and set:

    server { underscores_in_headers on;
    Last edited by Anshul; 11-07-09 at 12:30.

  3. #3
    Junior Member
    Join Date
    Sep 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Default

    I too have smiliar problem on my apach and nginx as proxy server.. I can't get this modification to get work with the latest version of Vbulletin 3.8.4..

    Please give me the updated version of this modification or please attach the modified file for me..
    Thank you.

  4. #4
    Administrator GumSlone's Avatar
    Join Date
    Mar 2005
    Location
    Mars, GumCity
    Posts
    1,494
    Thanks
    125
    Thanked 573 Times in 201 Posts
    Blog Entries
    2
    Rep Power
    10

    Default

    here is the editet file for vb 3.8.4 i havent tested it because here is an older version of vb installed, hope it works.

    extract it and upload to includes/ directory
    Attached Files Attached Files
    Advertise your mobile site for FREE with [Only registered and activated users can see links. Click Here To Register...]

    [Only registered and activated users can see links. Click Here To Register...]


  5. #5
    Administrator GumSlone's Avatar
    Join Date
    Mar 2005
    Location
    Mars, GumCity
    Posts
    1,494
    Thanks
    125
    Thanked 573 Times in 201 Posts
    Blog Entries
    2
    Rep Power
    10

    Default

    btw. another way to get real ip is to install the mod_rpaf install instruction which worked for me you can find here: [Only registered and activated users can see links. Click Here To Register...]
    Advertise your mobile site for FREE with [Only registered and activated users can see links. Click Here To Register...]

    [Only registered and activated users can see links. Click Here To Register...]


  6. #6
    Junior Member
    Join Date
    Sep 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Default

    Thank you very much... It works :D

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. vBulletin v3.8.1 **Nulled**
    By MaD-DoC in forum Scripts Forum
    Replies: 0
    Last Post: 18-03-09, 15:24
  2. Vbulletin V3.7.0 Gold
    By jayasanka in forum Scripts Forum
    Replies: 7
    Last Post: 22-06-08, 04:00
  3. Vbulletin 3.6.8 Pre-moded
    By DJCheezy in forum Scripts Forum
    Replies: 6
    Last Post: 15-06-08, 02:28

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

SEO by vBSEO

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19