The keywords here are secure, organised and future-proofed. All we have to do, though, is to set up a logical file structure that allows for our web files and their associated files, such as for logging, and make sure that the system is pinned down with secure ownership and permissions.
Really, it's dead simple …
Create the Site File Structure
Let's add the web directory, in which all your webs will reside:-
And, in there, add a standard set of four folders, per domain. I'll add folders for 2 domains, ‘someDomain.com' and ‘anotherDomain.com'. Add as many as you like:-
Add Users, Groups & Permissions
Setup users & groups with appropriate ownership permissions:-
.. we've assumed SuperUser permissions, added the group webmasters with web file permissions and added the Nginx user www-data to the new group.
Edit the web directory ownership. In my case, I want user ‘USERNAME' & group ‘webmasters' to own that:-
Looking ahead, we set the group id to ‘webmasters' for newly-created files & folders:-
And logout of ‘root' account (which takes you back to your user account in the CLI):-
If you're going to upload your site, as explained below, then there's no point doing this. Then again, if you just want to test the web server and the DNS * for your domain, then you'll be wanting a dummy page.
Create a homepage for the first new domain:-
…pasting some content within:-
…CTRL-X to quit, press ‘y' to save & hit return.
Optionally, repeat for subsequent domains.
Upload your Sites Using SFTP
Refer to Setup FileZilla for Secure FTP (SFTP) for how to set up a popular Secure FTP client (with SSH tunnelling for data encryption.)
Within the document structure we set up above, the web files for each site sit in the ‘public' folder. To be clear, log into an FTP client and head to your equivalent to:-
You guessed it. You can upload your site & blog files in there, binning any test homepage you may have created above.
You know this by now, huh? Let's keep danger at bay.