Lemp on Ubuntu - where should I place my website


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/ /var/www/

What about multiple sites? /var/www/public_html/ /var/www/public_html/ 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).


Submit an answer

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!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

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/ <br>/var/www/ <br> <br>Thanks again for your help! <br> <br>Tony

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/ <br> /var/www/ <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: <br> <br>This Server Fault post is also related to your question: