Hi all, i’m new about the “world” of web hosting. So i decided to start with a small droplet to create a webserver that hosts multiple website. So i decided to install LAMP and some test folder under the path: /var/www/html
The structure is like this:
/var/www/html/site1/
/var/www/html/site2/
/var/www/html/site3/
You can see i don’t use the suggested “public_html” folder. This because (and for sure im wrong) i don’t see the advantages to have something like this:
/var/www/html/site1/public_html
/var/www/html/site2/public_html
/var/www/html/site3/public_html
Where are the advantages to use that folder ? every provider uses that so of course there is a reason (probably about to be more safe)
Can someone give me some basic example why this folder is necessary?
thank you
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!
The primary reason you will often find a directory structure like that is that the web host may be storing other types of files for the site that they want associated with the site, but not shared publicly. For instance, on some web hosts you will have a log directory where the logs for just your domain are stored. This way the webhost can give FTP access to the /var/www/html/site1/ directory to the end user and they can access all files related to their service.
One of the original reasons that this directory structure became common is that back in the 90’s when the primary coding language for websites was Perl/CGI scripts, it was common practice to keep these files in a cgi-bin directory outside the main web root rather than having executables within the web root. This is no longer a concern today but the convention lives on.
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.