limit apache listening

Discussion in 'General' started by matej, Jul 17, 2009.

  1. matej

    matej New Member

    Is it possible to limit some site that it will be accessible from just some ip (submask)?

    Thanks for answer
     
    Last edited: Jul 17, 2009
  2. Mark_NL

    Mark_NL Member

    - You can put an .htaccess file in the document root of the designated website
    - You can add Allow / Deny rules in your VirtualHost declaration

    fmi: http://www.freewebmasterhelp.com/tutorials/htaccess/
    (i think you'll find your information on page 2 of that how-to)
     
  3. matej

    matej New Member

    .htaccess is not OK.
    Where should I add allow/deny rules in virtualhost declaration? Is it possible through ispconfig?

    Thanks for answer.
     
  4. Mark_NL

    Mark_NL Member

    You can do that in the "Apache Directives" text area when you look at a site's preferences, put something in it like this:

    Code:
    <Directory /var/www/yourwebsite>
     Order deny,allow
     Deny from all
     Allow from 192.168.1.2
     Allow from 10.10.0.
    </Directory>
    This will only allow access from 192.168.1.2 and all machines in the 10.10.0.0/24 range
     
  5. matej

    matej New Member

    Thanks for answer. I've done it... but site is still accessible from all ip-s. Should I enable some apache module?
    Must directory point to /var/www/yourwebsite or /var/www/yourwebsite/web?
     
  6. Mark_NL

    Mark_NL Member

    Ah yes you're using ISPConfig .. then you should point it to:
    /var/www/yourwebsite/web

    Can you show me the piece of code you've added in the Apache Directive field?
     
  7. matej

    matej New Member

    <Directory /var/www/html/internal.domain.net/web>
    Order deny,allow
    Deny from all
    Allow from 84.255.228.90
    </Directory>

    As I understand this shuld limit access tho this virtual host just from specified IP address.
     
  8. Mark_NL

    Mark_NL Member

    i forgot allowoverride, sry :)
     
  9. matej

    matej New Member

    Thanks. But still same. A can access to website from all other's IP. Is it possible that I have some problem with my apache configuraton?
     
  10. falko

    falko Super Moderator Howtoforge Staff

    Did you restart Apache? Any errors in Apache's error log?
     
  11. matej

    matej New Member

    Yes, I've restarted apache. I've also checked that - what am I wrote in ispconfig is in Vhost_ispconfig.conf file... and restart of apache went ok without any errors.
    Is it possible that I don't have apache correctly configured (some missing module) or any other idea..
     

Share This Page