The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Apache include editor does not work

Discussion in 'EasyApache' started by benniblanco, Aug 4, 2013.

  1. benniblanco

    benniblanco Member

    Joined:
    Jan 21, 2013
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    We are under dos attack and since about 7 days trying to figure out the way to mitigate it.
    Softlayer box WHM 11.38.1 (build 15)


    Installed few mods to protect ourself but none of them seem to have an effect on the zombie IP's

    Today we fund a solution by redirecting them trough site root htaccess and it works.


    Code:
    RewriteEngine On
    
    SetEnvIf User-Agent ".*MSIE 6.0; Windows NT 5.1; SV1.*" dontlog
    RewriteCond %{HTTP_USER_AGENT} ".*MSIE 6.0; Windows NT 5.1; SV1.$" [OR]
    RewriteCond %{HTTP_USER_AGENT} ".*MSIE 6.0; Windows NT 5.1;1813.$" [OR]
    RewriteCond %{HTTP_USER_AGENT} "^(?:User-Agent: )?Mozilla/4.0 \(compatible; MSIE 6.0; Windows NT 5.1;(?: SV1|1813)\)$" [OR] 
    RewriteCond %{HTTP_USER_AGENT} "MSIE 6.0; Windows NT 5.1; SV1"
    RewriteRule ^(.*)$ http://127.0.0.1/$1 [R=302,L]

    But we want to do this on server level so we added the lines that work in htaccess in Include Editor and tested all 3 positions and none of them work. Soon as we remove those lines from htaccess
    and put them in Include editor instead the IP's are not redirected anymore.

    Just had Mike tech from SL try to figure this out for about 2h on the phone and we both came to a conclusion that the editor is not accepting the changes.

    Mike also wanted to help us remove the redirect log for those IP's ( line one in code above combined with How To Tell Apache To Not Log Certain Requests In Its Access Log | HowtoForge - Linux Howtos and Tutorials ) but again include editor is not accepting the change
     
  2. quietFinn

    quietFinn Well-Known Member

    Joined:
    Feb 4, 2006
    Messages:
    998
    Likes Received:
    10
    Trophy Points:
    18
    Location:
    Finland
    cPanel Access Level:
    Root Administrator
    Apache include editor is a user interface to edit the files in directory /usr/local/apache/conf/includes
    Do you mean that Apache include editor does not write your configurations in the config files in that directory?
    Or do you mean that your configurations have no effect?

    I have not tested rewrite rules in Apache config, but Apache documentation says this:
    mod_rewrite - Apache HTTP Server
     
  3. benniblanco

    benniblanco Member

    Joined:
    Jan 21, 2013
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    here is where we must include any change that should affect http.config Screenshot by Lightshot, and we tested all 3 positions , none of them take affect. That code block works immediatly if placed in site_root/.htaccess
     
  4. kernow

    kernow Well-Known Member

    Joined:
    Jul 23, 2004
    Messages:
    865
    Likes Received:
    9
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
  5. benniblanco

    benniblanco Member

    Joined:
    Jan 21, 2013
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    tell me about , I think is time to move
     
  6. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    653
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    Try including the following lines in your custom Apache include:

    Code:
    RewriteLog "/usr/local/apache/logs/rewrite.log"
    RewriteLogLevel 2
    Then, check to see if the rewrites are logged to the "/usr/local/apache/logs/rewrite.log" file.

    Thank you.
     
  7. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,458
    Likes Received:
    22
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    Please ensure httpd.conf is rebuilt after using the include editor. Here is what worked for me:

    1. Used the include editor to add the rewrite rules. I ensured it matched exactly what you had in the screen shot
    2. Via the command line, I verified the rewrite rules were added to the proper include file:
    Code:
    $ cat /usr/local//apache/conf/includes/post_virtualhost_global.conf 
    
    3. Checked for presence of post_virtualhost_global.conf in httpd.conf:
    Code:
    $ grep post_virtualhost /usr/local/apache/conf/httpd.conf
    
    4. Rebuilt httpd.conf to put the include file in place:
    Code:
    $ /scripts/rebuildhttpdconf 
    
    5. Repeated step 3:
    Code:
    $ grep post_virtualhost /usr/local/apache/conf/httpd.conf
    Include "/usr/local/apache/conf/includes/post_virtualhost_global.conf"
    
    6. Restart apache
    Code:
    /scripts/restartsrv_apache
    
     
Loading...

Share This Page