This guide walks you through hosting multiple parked domains (also called domain aliases) on a single LAMP (Linux, Apache, MySQL, PHP) server. You’ll learn how to configure Apache virtual hosts so that several domain names serve the same website content, while keeping each domain’s email and SSL certificates separate if needed. Before starting, you need root or sudo access to your server, and the domains must already have their DNS A records pointing to your server’s IP address.
What You’ll Need
- A LAMP server (any modern Linux distribution, Apache 2.4+, MySQL/MariaDB, PHP)
- Root or sudo access to the server
- At least one primary domain and one or more parked domains
- DNS control for all domains (to point them to your server)
- A text editor (nano, vim, or similar)
Step-by-Step
- Prepare your DNS records. For each parked domain, create an A record pointing to your server’s public IP address. If you use IPv6, also add an AAAA record. Wait for DNS propagation (can take a few hours, but often less).
- Log into your server via SSH:
ssh user@your-server-ip - Identify your document root. Decide which directory holds the website content for the primary domain. Typically it’s something like
/var/www/htmlor/var/www/primarydomain.com. All parked domains will serve files from this same directory. - Create or locate the Apache virtual host file for your primary domain. On Debian/Ubuntu, these are in
/etc/apache2/sites-available/. On CentOS/RHEL, they are in/etc/httpd/conf.d/. If you already have a virtual host for your primary domain, note its filename (e.g.,primary.conf). - Edit the primary virtual host file. Open it with sudo:
sudo nano /etc/apache2/sites-available/primary.conf. Inside the<VirtualHost *:80>block, add aServerAliasline listing all parked domains, separated by spaces. For example:ServerName primary.com ServerAlias parked1.com www.parked1.com parked2.com www.parked2.com
If you have many parked domains, you can use a wildcard like
ServerAlias *.parked1.combut only if you want all subdomains to work too. - Save the file and exit (in nano: Ctrl+X, then Y, then Enter).
- Enable the site if it’s not already enabled. On Debian/Ubuntu:
sudo a2ensite primary.conf. On CentOS/RHEL, the conf.d files are automatically loaded. - Test the Apache configuration. Run
sudo apachectl configtestorsudo apache2ctl configtest. You should seeSyntax OK. If there’s an error, fix it before proceeding. - Reload Apache to apply changes:
sudo systemctl reload apache2(Debian/Ubuntu) orsudo systemctl reload httpd(CentOS/RHEL). - Verify the parked domains work. Visit each parked domain in a browser. If you see the same content as the primary domain, it’s working. If not, check DNS propagation and Apache logs.
- Optional: Set up SSL for parked domains. If you use Let’s Encrypt with certbot, run
sudo certbot --apacheand follow the prompts to obtain certificates for each domain. This will create separate virtual hosts for HTTPS, so you’ll need to add the same ServerAlias lines to those files.
Common Mistakes
- Forgetting ServerAlias – Without it, Apache will use the default site or reject the domain with a 404.
- DNS not propagated – The domain may point to an old IP. Use
digornslookupto check. - Editing the wrong virtual host file – Make sure you edit the file that corresponds to the primary domain, not the default site.
- Not reloading Apache – Changes won’t take effect until you reload or restart.
- Using ServerName instead of ServerAlias – ServerName should be the primary domain; parked domains go in ServerAlias.
Tips
- Use a wildcard ServerAlias if you want all subdomains of a parked domain to work (e.g.,
*.parked1.com). - Keep a list of all parked domains in a comment in the virtual host file for easy maintenance.
- If you use a CMS like WordPress, ensure the site URL settings are correct (often you can leave them as the primary domain, but some plugins may need adjustment).
- For email, you may need to configure a separate mail server or use MX records pointing to the same server with appropriate virtual domains.
- Test with
curl -H "Host: parked1.com" http://localhostto see what Apache serves without waiting for DNS.
Troubleshooting
- Domain shows default Apache page – This means the virtual host isn’t matching. Check that the ServerAlias is correct and that the virtual host is enabled. Also ensure the domain resolves to your server’s IP.
- 404 Not Found – The virtual host is matching, but the document root doesn’t have the expected files. Verify the DocumentRoot path and permissions.
- SSL certificate errors – If you set up HTTPS for the primary domain but not for parked domains, browsers will warn. Obtain a cert for each parked domain or use a wildcard cert.
- Apache won’t reload – Run
sudo apachectl configtestto see syntax errors. Common issues include missing closing tags or duplicate ServerName directives. - Changes not appearing – Clear your browser cache or try a different browser/incognito. Also check that DNS has updated (use
dig parked1.com).
Frequently Asked Questions
Can I park a domain that has a different TLD (like .net) on the same site?
Yes, absolutely. ServerAlias accepts any domain name, regardless of TLD. Just add it to the list.
Will parked domains affect my primary domain’s SEO?
Generally, no, as long as you don’t create duplicate content issues. It’s often recommended to set up a 301 redirect from parked domains to the primary domain to consolidate SEO, but if you want them to serve identical content, that’s fine too.
How do I set up email for a parked domain?
Email requires a mail server (like Postfix) configured to accept mail for those domains. You’ll need to add the domains as virtual domains in your mail server and set up MX records. This is separate from Apache configuration.
Can I park a domain that is already used elsewhere?
No, a domain can only point to one server at a time via DNS. If the domain is actively used elsewhere, you’ll need to change its DNS records to point to your server.
What if I want different content on a parked domain?
Then it’s not a parked domain; it’s a separate site. You would create a new virtual host with its own DocumentRoot. Parked domains are specifically for serving the same content.
Do I need to restart Apache or just reload?
Reload is sufficient for configuration changes. Restart is only needed if you change modules or the main configuration file. Reload is faster and doesn’t drop connections.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.
More cards in this drawer
- Poco X3 GT Dimensity 1100 67W Fast Charging Launched?5.00 min/km
- Flash Converter: What It Is & How to Use It
- Choosing a Pipe Flow Meter for Swirling Flow
- Motorola Phone Recovery: How to Recover Data
- Convert 2D Videos to Oculus Rift VR: How-To
- DRAM Light on Motherboard: Meaning & Fixes5.00 min/km