Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
add comment

2 Answers 2

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"
        }
}
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
add comment
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
add comment

Your Answer

 
discard

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.