Default location of web site content
Solution 1
It appears that we inherit this policy from Debian. The closest discussion I can seem to find on this policy is from this discussion in 2003.
However I did find a new draft policy (Check out section 3.1) that appears to have more detail which might help solve your question. It specifically mentions the Filesystem Hierarchy Standard. According to that /usr/share/doc
includes "Architecture-independent (shared) data.", which includes web pages that user's can't modify.
Since Mediawiki is user editable /var/lib/mediawiki
would be the place for it to go since the FHS says that /var/lib
is the place for "State information. Persistent data modified by programs as they run, e.g., databases, packaging system metadata, etc.
" and the manual says:
User uploaded content
A unique subdirectory of /var/lib/PACKAGE
The rest of the section in the manual explains architecture dependent things (like PHP and Perl).
This information is marked Draft however so I am not sure if it's enforced or pending in Debian. I would expect that if this were the final policy that we would likely inherit it from Debian.
So I guess the partial answer is "The FHS says so and Debian follows it so we do." I (unfortunately) cannot find any information on the justification/reasons why the FHS is the way it is in this regard, maybe someone else will have better luck finding this information and adding an answer.
Solution 2
Your custom content indeed goes to /var/www
- where you can edit files, move them around, etc.
However, PHP (and other) applications from the package repositories may install their internal libraries to /usr/share/packagename
and /var/lib/packagename
to better fit in with other (non-web) applications. See this list of MediaWiki package contents.
Also, packages may publish their HTML (and other) documentation on your local webserver if you are running one. Apache 2's default configuration on Ubuntu allows access to system documentation from localhost under the /doc
directory. However, this is another topic.
Related videos on Youtube
Peter Mortensen
(Last updated 2018-04-15.) Experienced application developer. Software Engineer. M.Sc.E.E. C++ (10 years), software engineering, .NET/C#/VB.NET (7 years), usability testing, Perl, scientific computing, Python, Windows/Macintosh/Linux, Z80 assembly. Some useful links related to Super User: Find Ubuntu version (and Linux kernel version) My other accounts: Experienced application developer. Software Engineer. M.Sc.E.E. C++ (10 years), software engineering, .NET/C#/VB.NET (7 years), usability testing, Perl, scientific computing, Python, Windows/Macintosh/Linux, Z80 assembly. My other accounts: iRosetta. [/]. Stack Overflow (SO). [/]. Server Fault (SF). [/]. Super User (SU). [/]. Meta Stack Overflow (MSO). [/]. Careers. [/]. Other My 15 minutes of fame on Super User Blog. Sample: Jump the shark. LinkedIn profile @PeterMortensen (Twitter) Google profile Quora profile GitHub profile Full jump page with other SOFU related, Stack Exchange sites, etc. Contact I can be contacted through this reCAPTCHA (requires JavaScript to be allowed from google.com).
Updated on September 17, 2022Comments
-
Peter Mortensen over 1 year
I am looking to install MediaWiki on a production server (after doing a test on a development one). I could not really understand why the default location for the MediaWiki files is
/var/lib/mediawiki
. I would have thought/var/www
would've made more sense.I did some research and in Ubuntu Policy Manual, Chapter 11 - Customized programs, 11.5 Web servers and applications it says the following.
Web Document Root
Web Applications should try to avoid storing files in the Web Document Root. Instead >they should use the /usr/share/doc/package directory for documents and register the Web >Application via the doc-base package. If access to the web document root is unavoidable >then use
/var/www
Why is this?
-
jrg over 13 yearsI'm not sure I understand your question here. To me it sounds like you're wondering why it's stored in '/usr/share/doc/package` instead of '/var/www` - and to my knowledge, it's fairly easy to edit the apache config files.
-
-
Jorge Castro over 13 yearsI think he's just looking for an explanation of the policy.
-
Admin over 13 yearsMy reason for asking the question is that to me the /var folder is for things like logs and a folder /lib would be for things like libraries. /var/lib just felt like it was the wrong folder and I was tempted to put my wiki in a different location but thanks for two excellent answers. I'll leave it in the default location now.