0

I am using Ubuntu 14.04.2 LTS server.

I want to restrict user from accessing a sub-domain. So I searched across web, so this link I found helpful but I can not access /etc/apache2/httpd.conf file as it not exist.

So I searched for the better answer. I got this, But then I thought that I should make change in that domain conf file instead of following this link.

But Now I am thinking to make changes in conf file in /etc/apache2/sites-available folder for that domain.

Here is that file looks like

ServerAdmin [email protected]
ServerName asd.domain.com
ServerAlias asd.domain.com
DocumentRoot /var/www/public_html/asd.domain.com

And now I added one line as follows

Allow from <my.ip.address.000>

But now I am not able to restart the because Allow is not allowed. Can anybody help on this?

1

1 Answer 1

0

It's more versatile to do this via .htaccess.

This will prevent the files to be read, even if you have a configuration problem allowing the folder to be accessed another way, like if it's a subdirectory of your root (e.g. /var/www/mysubdomain).

# ALLOW USER BY IP
<Limit GET POST>
 order deny,allow
 deny from all
 allow from 1.2.3.4
</Limit>

Just change the IP 1.2.3.4 to your allowed address range.

2
  • what are the advantages and disadvantages if we get this done by .htaccess? How we can accomplish using .conf file?
    – KuKu
    Nov 30, 2015 at 11:05
  • I don't know any disadvantage at the moment, but the advantage is in my answer. Additionally, no need to restart apache on changes. Nov 30, 2015 at 11:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .