Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm used to put them in /var/www or /home/www with a symlynk to /var/www when using apache. Not sure why, but I read that it was a security matter.

Is that the place for nginx websites too?

share|improve this question
add comment

4 Answers

The most appropriate place for web content under any server is under /srv.

share|improve this answer
add comment

If you are looking for a standard, then the standard would be defined by the Filesystem Hierarchy Standard. This standard says that they should be located beneath /srv. If the data is owned by one particular user, then locating the files under that user's home directory is also appropriate. /var/www is the most common location for this. However, this directory is not defined by the standard.

share|improve this answer
add comment

I'm mostly using /home/$site-owning-user/foo.bar.com/(htdocs|logs), as the sites my servers host are user-controlled; or /home/$site-owning-group/... if multiple users are controlling a site. This keeps all of a user's files together for easier backup and monitoring and such.

For non-user-controlled sites (eg webapps installed by the sysadmin from packages), /srv probably makes more sense

share|improve this answer
add comment

Since Nginx has the root directive to point to where files are, choosing the place to put them really is mostly a matter of taste and setup needs.

However it is common Practice to either put them in /www, /var/www, or /srv/www with the later a symlink to /var/www (depending on the distro)

share|improve this answer
add comment

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.