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/?

link|improve this question

feedback

2 Answers

bind to localhost only:

server.bind                = "localhost"

use iptables:

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

use $HTTP["remoteip"]:

$HTTP["remoteip"] =~ "127.0.0.1" {
        alias.url += (
                "/" => "/path_to_dir/",
        )
        $HTTP["url"] =~ "^/" {
                dir-listing.activate = "enable"
        }
}
link|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
feedback
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.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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