/var/www/ vs. /home/user/public/mydomain.com/ ?
https://www.linode.com/docs/websites/hosting-a-website
It's basically the same but the big difference I see is that now this guide is putting virtual hosts in the /var/www/ directory. When I set up my hosts a couple weeks ago this same guide said to put virtual hosts in /home/user/public/mydomain.com/
so my DocumentRoot in my .conf files look like:
DocumentRoot /home/user/public/mydomain.com/public
The DocumentRoot in the current version of .conf code in the guide look like :
DocumentRoot /var/www/example.com/public_html
Why would this have changed?
What is the difference between these two different DocumentRoots?
Is is better to file in /var/www/?
Does having multiple Virtual Hosts affect where they should be filed?
3 Replies
You can use either location. The /var/www location is the default for some distributions, such as Ubuntu. I always use the /home/user location.
Just so you know, you can use any directory you want. For example, I don't use the 'public' directory. I use something like:
/home/msj/mainstreetjames.com (for the main site)
/home/msj/demos.mainstreetjames.com (for the demos site for my clients to see)
/home/msj/test.mainstreetjames.com (test code for clients before the changes go live)
I could just as easily use:
/var/www/msj/mainstreetjames.com (for the main site)
/var/www/msj/demos.mainstreetjames.com (for the demos site for my clients to see)
/var/www/msj/test.mainstreetjames.com (test code for clients before the changes go live)
or:
/var/www/mainstreetjames.com (for the main site)
/var/www/demos.mainstreetjames.com (for the demos site for my clients to see)
/var/www/test.mainstreetjames.com (test code for clients before the changes go live)
or:
/clients/sites/msj/mainstreetjames.com (for the main site)
/clients/sites/msj/demos.mainstreetjames.com (for the demos site for my clients to see)
/clients/sites/msj/test.mainstreetjames.com (test code for clients before the changes go live)
MSJ