Essential Linux Folder Structure for Web Hosting on a VPS

Learn the essential Linux folder structure for VPS hosting and understand where configs, logs, and websites live.

If you are new to VPS hosting, Linux directories can feel confusing at first. This guide explains the essential Linux folder structure for VPS hosting so you know where configuration files, website files, and logs are located. Understanding this layout makes every other server task easier.

Table of Contents

Why Linux Folder Structure Confuses New VPS Users

On shared hosting, you rarely see the server. On a VPS, everything is visible. Linux organizes files by purpose, not by application, which can be confusing if you expect “one folder per website.”

Once you understand where things live and why, Linux starts to feel logical. You will know where to edit configuration files, where your websites actually live, and where to look when something breaks.

The Most Important Linux Directories You Should Know

You do not need to memorize everything. These are the directories you will work with constantly when following VPSFix guides.

/etc — Configuration Files

This directory contains configuration files for almost all system services.

Common paths you will see:

/etc/nginx/ → Nginx configuration
/etc/php/ → PHP settings
/etc/php/8.3/fpm/ → PHP-FPM pool and php.ini
/etc/mysql/ → MariaDB configuration
/etc/ssh/ → SSH configuration

If you are editing a config file, it almost always lives under /etc.

/var/www — Website Files (LEMP)

On manual LEMP setups, websites usually live here.

Examples:

/var/www/example.com/public_html
/var/www/html

Nginx server blocks point to these directories using the root directive.

/home — Website Files (Virtualmin)

Virtualmin uses /home for each domain.

Typical structure:

/home/example/public_html
/home/example/logs
/home/example/etc

Each domain runs under its own system user, which improves isolation and security.

/var/log — Logs (Very Important)

When something breaks, logs tell you why.

Key log locations:

/var/log/nginx/ → Nginx access and error logs
/var/log/mysql/ → MariaDB logs
/var/log/syslog → System-wide events
/var/log/php8.3-fpm.log → PHP-FPM issues

Checking logs should be your first troubleshooting step.

/usr — Installed Software

This directory contains installed binaries and libraries.

You will see things like:

/usr/bin/php
/usr/bin/nginx
/usr/sbin/

You usually don’t edit files here, but you will run commands from this path.

/var/lib — Application Data

This directory stores runtime data for services.

Examples:

/var/lib/mysql → Database files
/var/lib/php/sessions → PHP session files

You should not modify files here manually unless you know exactly what you are doing.

/tmp — Temporary Files

Temporary files live here.

Used for:

• Uploads
• Cache
• Install scripts

Files in /tmp can be cleared automatically on reboot.

Where Nginx Server Blocks Live

On Ubuntu, Nginx uses:

/etc/nginx/sites-available/
/etc/nginx/sites-enabled/

You create configs in sites-available and enable them with symlinks.

Virtualmin handles this automatically, but the files still exist behind the scenes.

Where PHP-FPM Pools Live

PHP-FPM pools define how PHP processes run.

Common path:

/etc/php/8.3/fpm/pool.d/

Each pool controls memory limits, users, and process counts.

Where MariaDB Configuration Lives

MariaDB config files are split across:

/etc/mysql/mariadb.conf.d/
/etc/mysql/my.cnf

This is where you tune performance and enable logs.

You Don’t Need to Memorize Everything

You don’t need to remember every directory. What matters is recognizing patterns. Config files live in /etc, websites live in /home or /var/www, and logs live in /var/log.

As you follow guides, these paths will become familiar very quickly.

Conclusion

Understanding the Linux folder structure removes a lot of fear from VPS management. Once you know where configuration files, websites, and logs are located, troubleshooting and setup become much easier.

Now that you know where things live, the next step is learning how to actually work with them from the command line. The next guide covers the essential Linux commands you will use in every VPSFix tutorial: Essential Linux Commands for VPS Beginners.

Tharindu

Hey!! I'm Tharindu. I'm from Sri Lanka. I'm a part time freelancer and this is my blog where I write about everything I think might be useful to readers. If you read a tutorial here and want to hire me, contact me here.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button