Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm turning my VPS into a development server which will hold development copies of all my websites, controlled by git. Of course, I installed the LAMP server so I can test them.

I've already configured Apache to server through port 8080. However I'm trying to get it to be much more secure. The idea is to only allow certain people to view the content (based on IP or password I guess). Is there a way I can do this?

Another thing I was trying to figure out is what to chown and chgrp all the files in /var/www to. By default (at least in my case) everything is owner by root -- which is bad news. What's the best practise here?

share|improve this question

3 Answers 3

up vote 1 down vote accepted

Edit your /etc/apache2/sites-enabled/000-default and between <Directory /var/www/></Directory> replace

Order allow,deny with Order deny,allow and

allow from all with deny from all.

Then you can simply add your ips with allow from IP. After an apache reload it should work.

See also the official documentation.

Also per default apache runs under the user www-data, so a chown -R www-data:www-data /var/www to change the user and group should solve your root problem.

share|improve this answer

The easiest way I know is using htpasswd. With it, you can create a database of users and passwords that will restrict the access to your website as you want. You have more info here: http://httpd.apache.org/docs/2.2/programs/htpasswd.html

share|improve this answer

Another thing I was trying to figure out is what to chown and chgrp all the files in /var/www to. By default (at least in my case) everything is owner by root -- which is bad news. What's the best practise here?

Add www-data to your username group and create a symlink inside /var/www to point to where you develop(such as /var/www/hello -> ~/projects/hello.

For authentication, I'd also recommend the htpasswd route.

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.