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.

I want to restrict the acess based on the ip address of the client. I have different url each client they should access.

Should I say

<VirtualHost client1:443> 
</VirtualHost> 
<VirtualHost client12:443>
</VirtualHost> 
<VirtualHost client3:443>
</VirtualHost>

thanks for you help in advance

share|improve this question

1 Answer 1

No, the IP:Port mapping specified in the VirtualHost block is the IP address on your server that this vhost will be served from, not the client's IP address.

To restrict access based on client IP, use mod_access rules, either in your VirtualHost stanza or via .htaccess files.

For instance:

Order deny,allow
Deny from all
Allow from 192.168.111.222

More details here.

share|improve this answer
    
Avoid using .htaccess files when possible and instead do the config in the main httpd.conf. Since apache will check the .htaccess file for changes continually, using it will decrease the server performance. –  Jenny D Sep 7 '12 at 5:01
    
@JennyD - I'd be impressed if you could demonstrate this actually decreasing performance. For frequently-used sites, this file will remain in the kernel read cache, meaning access to it (in RAM) may add a single millisecond to the request. Hardly anything to be concerned about. –  EEAA Sep 7 '12 at 5:08
    
If there is only one .htaccess file on the system - yes. But as this is Serverfault, not Superuser, I'm considering larger systems than that. –  Jenny D Sep 7 '12 at 7:35

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.