By info427180
Hello,
I’ve always used shared hosting, so this is quite a learning curve…thanks in advance for any help!
I’ve read different things about the default home directory so I’d like to know which is recommended. I’ll be using WordPress, and might add more than one site (will start with one and go from there) on the same droplet.
Is there any preference between (both are available): /var/www/ /usr/share/nginx/www/
What is considered best practice for adding a single site? /var/www/public_html/mysite.com /var/www/mysite.com/public_html
What about multiple sites? /var/www/public_html/mysite1.com /var/www/public_html/mysite2.com etc
Or is there more recommended structure?
I setup another directory as /home/, but I’m having a lot of permission issues with wordpress and I think I made a mistake in not using the default locations (which I didn’t understand until after I was finished).
Thanks!
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Since you are configuring the sites, it’s entirely up to you where you put them, though I recommend that you pick a structure and stick to it. As for what is convention/recommended, /var/www/ is a pretty normal location for web files, though /srv/www is used on some distributions. Serving from home directories is do-able, but it’s a pattern usually seen on shared hosting (eg. cPanel) to separate users’ files and isn’t entirely beneficial in a private system (relaxed permissions or server running as a user).
<br>
<br>Virtual hosts can, again, be structured any way you like. Personally I use /var/www as a base, with a folder for each virtual host, and the document root of each virtual host another level deep:
<br>
<br> /var/www/mysite.com/htdocs/
<br> /var/www/app.mysite.com/htdocs/
<br>
<br>The htdocs name aside (just a habit), I find this structure useful to group both public and private (logs, scripts, etc) aspects of a site together.
<br>
<br>There’s a decent thread on the Unix Stack Exchange site about where /should/ website files go: http://unix.stackexchange.com/questions/47436/why-is-the-root-directory-on-a-web-server-put-by-default-in-var-www/
<br>
<br>This Server Fault post is also related to your question: http://serverfault.com/questions/124127/linux-fhs-srv-vs-var-where-do-i-put-stuff
Hi Stephen, <br> <br>Thanks for your very helpful reply! I took a look at both links, as well as some additional research and it seems there’s no set answer, but there are a couple of structures that are considered common practice. <br> <br>I think I will follow your advice and use: <br> <br>/var/www/site1.com/public_html <br>/var/www/site2.com/public_html <br> <br>Thanks again for your help! <br> <br>Tony
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.