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?
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.
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
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)