0

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?

1

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.

1

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

1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.