cPanel folder structure: what public_html, mail, etc and tmp are for

Print
  • 0

File Manager and the main FTP account both open in your home folder, /home/username, where username is your cPanel login. Only public_html and the folders of your other domains are reachable from the internet. The rest of the home folder is private, and part of it is maintained by cPanel itself: editing it by hand can break your mail or your site. Here is what each folder does and which ones you can safely touch.

Folders for your websites

FolderWhat it holdsSeen on the web
public_htmlThe site of the primary domain. www in the home folder is only a shortcut (symbolic link) to the same place.Yes
Folders of addon domains and subdomainsEach site's own files. The exact paths are listed in cPanel under Domains, column Document Root.Yes, on their own domain
public_html/cgi-binCGI scripts, for example in Perl. Most modern sites leave it empty.Yes, as executed scripts
The home folder itselfFiles you want to keep on the server but not publish, for example a copy of a configuration file or an archive before you download it.No

Where to put a new site and how to upload it: Where to upload website files in cPanel.

Folders maintained by cPanel

You can open and look at these, but change them only through the matching cPanel tool.

  • mail: all mailboxes, where each message is a separate file. Manage it through Email Accounts and Email Disk Usage; deleting files here by hand can corrupt a mailbox.
  • etc: the mail settings of each domain, such as the list of addresses, their encrypted passwords and mailbox quotas.
  • tmp: temporary files and the working data of the visitor statistics tools. Leave it alone; if it grows unusually large, ask us before you clear it.
  • logs: archived access logs of your sites, when archiving is switched on in Metrics, Raw Access. Old archives can be deleted to free space.
  • ssl: private keys and certificates, including the free ones issued by AutoSSL (Automatic issuance of SSL). Never delete or share these files.
  • public_ftp: meant for anonymous FTP, where anyone may download files without a password. This only works if the server allows anonymous access; keep the folder empty and never store private files in it.

Hidden folders that start with a dot

Names that start with a dot are hidden in File Manager by default. To see them, click Settings in the top right corner and tick Show Hidden Files (dotfiles). The ones you will meet most often:

  • .trash: the File Manager trash. Deleted files stay here and keep using disk space until you empty it.
  • .htpasswds: passwords for folders protected with Directory Privacy.
  • .htaccess (a file, usually in public_html): rules for redirects, caching and access. A typo in it can bring the site down, so keep a copy before editing (Setup .htaccess file for popular CMS).
  • .cpanel and other dot folders created by cPanel and its tools: do not modify them.

Which file opens when the address has no file name

For an address such as https://example.md/, the server looks in the folder for an index file and shows the first one it finds, in a fixed order. In cPanel, index.htm and index.html come before index.php. Further down the list are less common names such as index.shtml, index.cgi, default.htm, default.html and home.html.

  • A forgotten index.html next to the index.php of WordPress or another CMS means visitors keep seeing the old page. Delete or rename it.
  • To force a different order, add one line at the top of the .htaccess file in that folder, for example DirectoryIndex index.php index.html.
  • If the folder has no index file at all, the visitor gets either a list of its files or a 403 error, depending on the setting in Advanced, Indexes. For folders with private content, choose No Indexing.

Good habits

Was this answer helpful?