Friday, June 9, 2017

apache http server - Convention on directory of file outside /var/www




By /var/www I am generically referring to the document root for Apache. Often times you want to work with files, but don't want them inside the doc root (PHP examples come to mind). The general advice is "put these files outside the document root and then include them in the appropriate manner".



That's well and good, but are there any conventions on where to put these files outside the doc root. I have often seend (and done) things like /var/some_dir, but is that really the intent of the /var directory? Is there a better location?



I've read the FHS and it seems to imply that /var is not the ideal location for such a directory.



Section 5.1:





/var contains variable data files. This includes spool directories and files, administrative and logging data, and
transient and temporary files



Applications must generally not add directories to the top level of /var. Such directories should only be added if
they have some system-wide implication, and in consultation with the FHS mailing list




Sure the files that would be going there are variable data files, but certainly of substance markedly different that the description provided in the above quote.



Nevertheless, no other directory seems like a better fit.




/opt - The files are not a third-party software application



/home - The files do not belong to a specific user



/usr - This dir should have read-only data, but does not seem to have an appropriate subdirectory



Certainly, I can't be the first person to raise this question?


Answer



In the Filesystem Hierarchy Standard,




/srv contains site-specific data which is served by this system.


There is your answer. It seems that /srv is the correct place to put this, but if you put it into /var/www, you are in good company.



Hope this helps!


No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...