Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

If I have 3 domain names: siteA, siteB, and siteC. Lets say all of these sites are stored on the same server, however I want to lock siteB down to only a certain subnet and siteC to a broader subnet.

Is there any way to achieve this using only IPTables and Apache?

share|improve this question
up vote 3 down vote accepted

Sure, apache's mod_access will take care of this nicely. Throw something like this into the .htaccess for the sites to which you want to restrict access:

Deny from all
Allow from 192.168.1.0/24
Allow from 1.2.3.4/32
share|improve this answer

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.