logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Need help blocking IP from server
Author
myswordnu



Joined: 26 Sep 2009
Posts: 9

PostPosted: Sun 27 Sep '09 19:29    Post subject: Need help blocking IP from server Reply with quote

Ok i cant for the life of me seem to block a IP from my server. All of the sites I go to tell me to put this script into a .htaccess , well what one i have like 12 files that have the tittle htaccess. none of which have just the name htaccess. they are all different like,

htaccess.html.en
htaccess.xml.ja
htaccess.html
htaccess.html.pt-br
htaccess.xml

which one am I supposed to input this script into there is no filed just called .htaccess. Does this mean i have to make a file just called .htaccess and put the script in it. If yes how so , how use notepad and save as all file types name it .htaccess ? I really cant find out how to do this or set it up and of course it is very important to know how to do this. So if some some could write out a quick walk threw on how to set it up for me I shall pray to god that you become rich.

Mybe its more simple then what I am trying to make it but still I cant seem to get it.
Back to top
glsmith
Moderator


Joined: 16 Oct 2007
Posts: 2268
Location: Sun Diego, USA

PostPosted: Sun 27 Sep '09 19:53    Post subject: Reply with quote

I have no idea what you mean by script, Apache Config directives sure but script (perl, php, ruby) no.

To save in Notepad choose Save As and enclose in quotes in the dialog
".htaccess" then click save.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7373
Location: Germany, Next to Hamburg

PostPosted: Sun 27 Sep '09 20:07    Post subject: Reply with quote

I guess these files are from the manual?!?! I think which script ever you run you have to create your own .htaccess file.
Which "script" do you want to put into it? Can you please post that?
Back to top
myswordnu



Joined: 26 Sep 2009
Posts: 9

PostPosted: Sun 27 Sep '09 20:49    Post subject: Reply with quote

For example, if you put the following .htaccess file in a directory, then it would operate on all directories beneath it:
Code:

Deny from evil-person.attbi.com
Deny from 51.128.65.62
Deny from 207.51.29



thats all I get from sites but not sure what they mean I have tried putting that code into a notepad and saving it as .htaccess (all file types) and putting it into my main directory but the person keeps coming back it does not block them.
Back to top
myswordnu



Joined: 26 Sep 2009
Posts: 9

PostPosted: Sun 27 Sep '09 20:50    Post subject: Reply with quote

of course i edit the it to the person IP and host
Back to top
glsmith
Moderator


Joined: 16 Oct 2007
Posts: 2268
Location: Sun Diego, USA

PostPosted: Sun 27 Sep '09 22:10    Post subject: Reply with quote

Limit must be one of the AllowOveride choices hard codded into the config for the Directory as that allows the use of Deny in an .htaccess file.

Deny from will 403 the user from that IP, they can come back but will get that error and nothing more. To block from even reaching your server, block at router/firewall

Apache 1.3 would simply not answer, unfortunately 2.x will answer with an error instead of simply ignoring connection (a sore spot I have with 2.x versions)

the file must be named simply ".htaccess" ie dot htaccess nothing more
Back to top
myswordnu



Joined: 26 Sep 2009
Posts: 9

PostPosted: Mon 28 Sep '09 0:31    Post subject: Reply with quote

so what I have to also add somthing into my config file for the .htaccess to work , What do I put and where at in the config file ?
Back to top
glsmith
Moderator


Joined: 16 Oct 2007
Posts: 2268
Location: Sun Diego, USA

PostPosted: Mon 28 Sep '09 1:19    Post subject: Reply with quote

httpd.conf

ServerName www.blahblah.com

DocumentRoot "c:/blahblah/htdocs"

<Directory "c:/blahblah/htdocs">
Options (whatever)
AllowOverride Limit (whatever else if anything)
Order Allow,Deny
Allow from all
</Directory>

See:
http://httpd.apache.org/docs/2.2/mod/core.html#allowoverride
http://httpd.apache.org/docs/2.2/howto/htaccess.html
Back to top
myswordnu



Joined: 26 Sep 2009
Posts: 9

PostPosted: Mon 28 Sep '09 6:33    Post subject: Reply with quote

OK thank you very much I am pretty sure I got it to work sad part is I found out the IP I was trying to block is some crazy bot and now its just using all kinds of IP address after I blocked its main one. I don't think it matters to much anyways cause everytime it connects to my server it still gets a 404 cause its trying to get a file not on my server. Still kinda annoying tho.

But yes thanks for your help guys _soon 2 B rich_
Back to top


Reply to topic   Topic: Need help blocking IP from server View previous topic :: View next topic
Post new topic   Forum Index -> Apache