Hosting Several Websites on One Account: When It Works

You can host multiple websites on one hosting account if each site gets its own folder, its own database and its own database user. The resource pool and the security boundary stay shared. That suits a handful of low-stakes sites you own. Client work and anything that takes payments belong on separate accounts.

The setup mistakes that hurt later are usually made on the second site, which gets dropped into a subfolder of the first because that was the quickest place to put it, and nobody revisits the decision once the site loads. Order matters. BestPaidHosting runs its shared plans on the Hepsia control panel rather than cPanel, so the menu names differ from most tutorials, but nothing below depends on which panel you use.

What the Sites Share, and What Each One Keeps

A few things can be separated per site. Each domain points at its own document root, the folder the web server reads that site from. Each site can have its own database, with a database user whose password opens nothing else. Mail routing and the certificate are set per domain too.

Everything else is pooled.

The account has a single processor allowance and a single cap on how many processes may run at once, and every site draws on both. If one site's search page starts running a slow query, its requests hold worker slots for longer, and visitors to every other site on the account wait in the same queue behind them.

The less obvious shared thing is identity. On almost every shared account, the files of every site belong to the same system user, and the PHP that runs each site runs as that user. The operating system sees one tenant. Code running inside one site can read and change files inside every other site, including the configuration file that holds each site's database password.

How to Host Multiple Websites on One Hosting Account, in Order

Run these steps for every domain you add, including the one that feels too small to bother with.

  1. Give the site a sibling folder, never a child. Put its document root beside the first site's, not inside it. A site nested at firstsite/shop/ also loads at firstsite.com/shop/, which publishes a duplicate of the whole second site under the wrong domain, and on Apache every .htaccess file in the folders above it is read too, so the first site's access rules and redirects can apply to the second. Check: request the folder name under the first domain. It should return a 404.

  2. Create a database and a user that belong to this site alone. Nothing stops you from reusing the first site's database user, and that is the shortcut to refuse. The new user should hold privileges on one database and nothing more, the equivalent of GRANT ALL ON site2_db.* TO 'site2_user'@'localhost'. That will not stop an attacker who already has your files, but it does confine a SQL injection in one site to that site's data. Then connect as the new user and run SHOW DATABASES;. You should see its own database and the built-in information_schema, and none of the other sites' databases.

  3. Point DNS at the account before you request a certificate. Free certificates are usually validated over HTTP: under Let's Encrypt's HTTP-01 challenge, the certificate authority fetches a file from the domain, so the domain has to resolve to this server first. Request the certificate for both the bare name and www. To confirm the order was right, dig +short example.com should return the account's IP address before you request anything, and the issued certificate should list both names.

  4. Turn on the HTTPS redirect last. Force HTTPS before the certificate exists, and every visitor lands on a full-page browser warning, usually because the server presented a certificate issued for some other name. Check: open plain http:// in a private window and confirm one redirect, then no warning.

  5. Set up mail records for this domain on their own. Each domain needs its own MX record and, if it sends mail at all, its own SPF record and DKIM key. A domain may publish only one SPF record; RFC 7208 treats two as a permanent error, which is exactly what happens when a newsletter service gets added as a second TXT record instead of merged into the first. How MX and TXT records work covers the syntax. Check: dig +short TXT example.com shows exactly one line beginning v=spf1.

  6. Decide how this site gets restored without the others. Restoring a whole-account backup rolls every site back to the same moment, which is a bad trade when only one of them broke. You want to be able to put back one folder and one database and leave the rest alone, and the only proof is having done it once. The method is in how to back up a website so the backup actually works.

If One Site Is Compromised, Assume They All Are

This is the cost of consolidation, and it is the one people skip when they are adding up what they save.

Because every site runs as the same user, one outdated plugin on the least important site is an entry point to all of them. The usual sequence is unremarkable. An attacker uploads a small PHP file through the vulnerable plugin, uses it to list the folders beside it, reads each site's configuration file for its database password, and plants code in every index.php it can write.

Cleanup follows the same shape. Clean one site and leave the others, and the backdoor sitting in a neighbor writes the infection straight back. Treat the account as the unit of compromise: every site gets checked and every database password changed, including on sites that looked untouched.

Some hosts narrow the reach with PHP's open_basedir setting, which limits the paths PHP's own file functions may open, so ask whether yours sets it per site. It has a well-known gap. A program launched from PHP is not bound by it.

Abuse handling works at the same level. Hosts generally act on the account that sent the spam, so a compromised side project can take your business site down with it.

Delete any site on the account that nobody updates anymore. A forgotten install from three years ago is the likeliest way in, and it protects nothing by sitting there. The security basics for a small business site apply to every site on the account, including the ones that earn nothing.

Which Sites Should Never Share an Account?

Client sites come first. When a client's site lives on your account, one stale plugin on either side reaches both. Access is where it bites in practice. An FTP login can often be limited to one folder, but whatever code the client's next developer uploads through it runs as the same user as everything else, so the limit stops mattering the moment that code executes. And when the relationship ends, you are extracting their site from an account tangled up with your own. Put each client on an account in their own name from the first day, because untangling it later costs more than the separate account ever would.

Anything transactional goes next, meaning a store or any site where customers log in. On a shared account the least maintained site sets the security level for the most valuable one, and a hobby blog should not have that job. Give the store its own account even while it is small.

Then the sites whose traffic you cannot predict. A post picked up by a large newsletter can multiply a site's requests within the hour, and the process ceiling it runs into belongs to the whole account, so every other site starts showing resource errors although nothing happened to them. Whether a spike-prone site needs a bigger plan or only better caching is the question of whether a site has outgrown shared hosting.

Before You Add the Fourth Site

The first two or three sites usually fit without anyone noticing. Run this list first.

  1. Count what the plan allows. The domain allowance and the database allowance are separate numbers. Count databases as sites plus staging copies, because a staging copy that shares the live database is not a staging copy.
  2. Count files per site. Every WordPress install carries a complete copy of core before anyone uploads a single image, and the file limit belongs to the account. From the folder that holds the sites: for d in */; do echo "$(find "$d" | wc -l) $d"; done | sort -rn
  3. Measure the combined busiest minute. The process limit applies to every site on the account at the same moment, so the number that matters is the busiest minute across all of them together, not each site's peak measured on its own. With logs in the standard combined format: cat site1.log site2.log | awk '{print substr($4,2,17)}' | sort | uniq -c | sort -rn | head -5. The units behind that ceiling are laid out in what hosting plan specifications actually mean.
  4. Write down when each site was last updated. A site without an answer leaves before a new one arrives.

Keep Them Together or Split Them Up

Site Same account? Why
Your own blog, portfolio or side projects Yes Low stakes, and you control every update
A domain that only redirects to your main site Yes No application to patch
A client's site No Code their developer uploads runs with access to your sites
A store, or anything with customer logins No The weakest site on the account sets its security level
A site prone to traffic spikes Separate, or a larger account It spends the process limit every other site depends on
An old site nobody maintains Delete it Nobody patches it, and it reaches every other site

If what you have is a handful of your own low-stakes sites, one account is the sensible way to run them. Take the counts from the list above and compare them against each tier of the shared hosting plans before adding the next domain. If the sites are all yours and the only problem is room, a bigger account keeps them together with more headroom, and how semi-dedicated hosting compares with a VPS explains that step. Split a site out the day it starts taking payments. Not the day after something goes wrong.

Leave a Comment

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