Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Sun Nov 30, 2014 10:13 am 
Offline
Newbie

Joined: Sun Nov 30, 2014 9:53 am
Posts: 4
Hi. This is somewhat related to another post (/var/www/ vs. /home/user/public/mydomain.com/ ?), but I think it deserves its own thread.

The Linode LAMP guide for Debian Wheezy -- https://www.linode.com/docs/websites/la ... n-7-wheezy -- says "All of the files for the sites that you host will be located in directories that exist underneath /srv/www."

But I've been using "/var/www" for forever. I'm curious whether continuing to use "/var/www" violates an Apache2 best practice? I searched and couldn't come up with a clear answer, and I value the opinions of this members/contributors of this forum.

Assume that the consensus is that using "/svr/www" is the best practice for Apache2. If I create a symbolic link from one directory to the other, would the link be created from the subdirectories under "/var/www" and linked into "/svr/www" or created in the subdirectories under "/srv/www" and linked into "/var/www"? (Or does it not matter so long as the link is created?)

Thanks.

Library Rat


Top
   
PostPosted: Sun Nov 30, 2014 2:35 pm 
Offline
Senior Member
User avatar

Joined: Sun Dec 27, 2009 11:12 pm
Posts: 1038
Location: Colorado, USA
It doesn't matter where you put your web files as long as all the config's point to that location.

_________________
Either provide enough details for people to help, or sit back and listen to the crickets chirp.
Security thru obscurity is a myth - and really really annoying.


Top
   
PostPosted: Sun Nov 30, 2014 3:09 pm 
Offline
Newbie

Joined: Sun Nov 30, 2014 9:53 am
Posts: 4
Thanks, vonskippy.


Top
   
PostPosted: Sun Nov 30, 2014 4:26 pm 
Offline
Senior Member

Joined: Wed Oct 20, 2010 12:35 pm
Posts: 111
Location: United Kingdom
LibraryRat wrote:
Thanks, vonskippy.


One reason that it might be better to use the /srv directory for websites is that you can have it on a separate partition and then only mount that partition with the options that you need. For instance you could set noexec, nodev and nosuid to improve security (only set noexec if you have no scripts, i.e your website is static). Having it on a different partition may also help with things like SELinux rules (although I'm not too sure on that). Also it will save you from accidentally filling up /var with log files and causing problems there.

Plus (and this is just personal opinion) I think keeping everything in /srv is cleaner.


Top
   
PostPosted: Sun Nov 30, 2014 5:34 pm 
Offline
Newbie

Joined: Sun Nov 30, 2014 9:53 am
Posts: 4
Thanks, Cromulent. I guess that's where I'm coming from. It seems that consistently using one over the other is a best practice (for Apache2 as well as any other app). Just didn't know whether Apache2's "internal plumbing" required the use of /srv/www vs. /var/www. Your other point about using a separate partition definitely makes sense. Again, thanks.


Top
   
PostPosted: Tue Dec 02, 2014 6:49 am 
Offline
Senior Member

Joined: Fri May 02, 2008 8:44 pm
Posts: 1121
LibraryRat wrote:
Just didn't know whether Apache2's "internal plumbing" required the use of /srv/www vs. /var/www.


There's nothing in Apache's "internal plumbing" that requires the DocumentRoot to be in any particular place. It's all controlled with configuration files in /etc/apache2. However, if the configuration files ever go missing or corrupt, Apache may revert to whatever is hardcoded into its source code, which usually coincides with the default DocumentRoot used by your Linux distribution. For Debian, that would be /var/www.

On the other hand, I usually avoid the distro-default path because it's often filled with junk that comes with the default installation, such as the "It works!" page, and depending on the distro, even a bunch of symlinks to things like phpmyadmin. You can delete that junk and add your website files instead, but if you ever need to reinstall Apache, the junk might come back :(


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group