Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Just installed it on my linux desktop, and I only want 1 or 2 files accessible to the outside world. Everything else should only be accessibly via http://localhost/ for various privacy/security reasons. It is just a test server, don't want just anybody accessing my large batch files.

How would you go about allowing only certain select files access to the internet and making everything else available only via http://localhost/?

share|improve this question

bind to localhost only:

server.bind                = "localhost"

use iptables:

iptables -I INPUT 1 -p tcp ! -s --dport 80 -j DROP

use $HTTP["remoteip"]:

$HTTP["remoteip"] =~ "" {
        alias.url += (
                "/" => "/path_to_dir/",
        $HTTP["url"] =~ "^/" {
                dir-listing.activate = "enable"
share|improve this answer
Could you give a little more explanation on any of this, alvosu? I have followed your steps, but it is unclear what exactly path_to_dir are etc... – darkAsPitch Feb 22 '11 at 4:56
Also that regular expression match for the remote_ip isn't right technically - it would still work I suppose. – darkAsPitch Feb 22 '11 at 5:13
up vote 0 down vote accepted

Here is the answer to the question I was looking for:

$HTTP["host"] != "localhost" {

     url.access-deny = ("")

     $HTTP["url"] =~ "^.*/only_allow_this_file\.php$" {
         url.access-deny = ("disable")


No ip tables needed! Simply change "only_allow_this_file" to whatever filename you are doing your testing with, and only that file will be accessible from the internet.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.