Skip to content

Complete Guide to OpenLiteSpeed Multiple Domains on One Droplet

Are you running one OpenLiteSpeed server and looking to install multiple domains efficiently?

If you already have a WordPress site on a DigitalOcean OpenLiteSpeed droplet, you can host multiple websites on a single droplet without provisioning extra servers or raising costs.

Each site runs independently with its own domain, database, and WordPress installation, providing isolation, improved security, and easier maintenance.

Follow this step-by-step guide to set everything up. Let’s get started.


Resources Required

  • One OpenLiteSpeed Server is installed. Currently, we are using a Digital Ocean droplet with Ubuntu 24.04 and OpenLiteSpeed WordPress installed. You can follow the same guide with other server providers as well.
  • Your new domain’s DNS A record pointed to your droplet’s IP. (make sure newdomain’s A resource points to your server IP)
  • SSH access to your server.
  • 15-20 minutes of focused time

Note: Throughout this guide, replace:

  • firstdomain.com with your actual first domain name (the one already installed)
  • newdomain.com with your new domain name

Step 1: Connect to Your Droplet

Option 1: Connect through the server provider’s dashboard (recommended)

In my case, I am using Digital Ocean. I just want to click on droplets and select my particular droplet on the OLS server, and click on console.

Option 2: Connect Directly From Systems (recommended)

Mac Users:

bash

ssh root@your_droplet_ip

Windows Users (PowerShell):

powershell

ssh root@your_droplet_ip

Windows Users (PuTTY):

  • Open PuTTY
  • Enter your droplet IP
  • Click “Open” and login as root

For more information, check the guide (How to connect a remote server with SSH). It normally works with every server.


Step 2: Create Directory Structure

Paste the code given below after you have been connected to the server and press Enter. Just make sure to change newdomain.com to your second domain name.

Bash

# Create directories (replace newdomain.com with your domain)
sudo mkdir -p /var/www/newdomain.com/html
sudo mkdir -p /var/www/newdomain.com/logs

# Set ownership
sudo chown -R www-data:www-data /var/www/newdomain.com

# Set permissions
sudo chmod -R 755 /var/www/newdomain.com

Step 3: Install WordPress

bash

# Navigate to directory
cd /var/www/newdomain.com/html

# Download WordPress
sudo wget https://wordpress.org/latest.tar.gz

# Extract
sudo tar -xzf latest.tar.gz
sudo mv wordpress/* .
sudo rm -rf wordpress latest.tar.gz

# Set ownership
sudo chown -R www-data:www-data /var/www/newdomain.com/html

Verify WordPress installation:

bash

ls -la

You should see WordPress files like wp-admin, wp-content, wp-config-sample.php.


Step 4: Create Database

Get your MySQL password from your first WordPress installation:

bash

cat /var/www/html/wp-config.php | grep DB_PASSWORD

Copy the password, then login to MySQL:

bash

sudo mysql -u wordpress -p

Paste the password when prompted.

Run these commands:

sql

CREATE DATABASE newdomain_wp CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
FLUSH PRIVILEGES;
SHOW DATABASES;
EXIT;

You should see newdomain_wp in the database list.


Step 5: Configure WordPress

bash

cd /var/www/newdomain.com/html
sudo cp wp-config-sample.php wp-config.php

Mac Users:

bash

sudo nano wp-config.php

Windows Users:

bash

sudo nano wp-config.php

Update these lines:

php

define( 'DB_NAME', 'newdomain_wp' );
define( 'DB_USER', 'wordpress' );
define( 'DB_PASSWORD', 'paste_your_password_here' );
define( 'DB_HOST', 'localhost' );

Important: Use the same MySQL password from Step 4.

Generate Security Keys

Open a new terminal and run:

bash

curl -s https://api.wordpress.org/secret-key/1.1/salt/

Copy all 8 keys. Go back to wp-config.php and replace the dummy keys (around line 49-56) with your generated keys.

Save and Exit:

  • Mac: Control + O, Enter, Control + X
  • Windows: Ctrl + O, Enter, Ctrl + X

Fix ownership:

bash

sudo chown www-data:www-data /var/www/newdomain.com/html/wp-config.php

Step 6: Create Virtual Host Configuration

Here’s the thing:

OpenLiteSpeed needs configuration to recognize your new site.

bash

# Create directory
sudo mkdir -p /usr/local/lsws/conf/vhosts/newdomain

# Create config file
sudo nano /usr/local/lsws/conf/vhosts/newdomain/vhconf.conf

First, check your PHP version:

bash

ls -la /usr/local/lsws/lsphp*/bin/php

You’ll see lsphp83 or lsphp84. Use that version in the config below.

Paste this configuration (replace lsphp83 with your version if needed):

docRoot                   $VH_ROOT/html

index  {
  useServer               0
  indexFiles              index.php, index.html
}

errorlog $VH_ROOT/logs/error.log {
  useServer               0
  logLevel                ERROR
  rollingSize             10M
}

accesslog $VH_ROOT/logs/access.log {
  useServer               0
  logLevel                ERROR
  rollingSize             10M
  keepDays                10
  compressArchive         0
}

scripthandler  {
  add                     lsapi:lsphp83 php
}

extprocessor lsphp83 {
  type                    lsapi
  address                 uds://tmp/lshttpd/lsphp83.sock
  maxConns                35
  env                     PHP_LSAPI_CHILDREN=35
  initTimeout             60
  retryTimeout            0
  persistConn             1
  respBuffer              0
  autoStart               1
  path                    /usr/local/lsws/lsphp83/bin/lsphp
  backlog                 100
  instances               1
  priority                0
  memSoftLimit            2047M
  memHardLimit            2047M
  procSoftLimit           1400
  procHardLimit           1500
}

rewrite  {
  enable                  1
  autoLoadHtaccess        1
}

Save and exit.


Step 7: Register Virtual Host

bash

sudo nano /usr/local/lsws/conf/httpd_config.conf

Find your existing virtual host (looks like this):

virtualhost wordpress {
  vhRoot                  /var/www/html
  configFile              /usr/local/lsws/conf/vhosts/wordpress/vhconf.conf
  allowSymbolLink         1
  enableScript            1
  restrained              0
  setUIDMode              2
}

Don’t change it. Add your new virtual host after it:

virtualhost newdomain {
  vhRoot                  /var/www/newdomain.com/
  configFile              $SERVER_ROOT/conf/vhosts/newdomain/vhconf.conf
  allowSymbolLink         1
  enableScript            1
  restrained              1
}

Save and exit.


Step 8: Map Domain to Virtual Host

The bottom line?

Your domain needs mapping to the virtual host.

Keep the same file open or reopen:

bash

sudo nano /usr/local/lsws/conf/httpd_config.conf

Find the listener with address *:80 (might be named listener wordpress {):

listener wordpress {
  address                 *:80
  secure                  0
  map                     wordpress firstdomain.com, www.firstdomain.com
}

Add your new domain:

listener wordpress {
  address                 *:80
  secure                  0
  map                     wordpress firstdomain.com, www.firstdomain.com
  map                     newdomain newdomain.com, www.newdomain.com
}

Note: firstdomain.com is the name of your first domain that’s already installed.

Save and exit.


Step 9: Restart OpenLiteSpeed

bash

sudo /usr/local/lsws/bin/lswsctrl restart

You should see: [OK] Send SIGUSR1 to [process_id]

Wait 10 seconds.


Step 10: Complete WordPress Installation

Test:

bash

curl -I http://newdomain.com

You should see HTTP/1.1 200 OK.

Open your browser:

http://newdomain.com

Complete the WordPress installation wizard.


Step 11: Install SSL Certificate

bash

# Install Certbot if needed
sudo apt update
sudo apt install certbot python3-certbot-apache -y

# Get SSL certificate
sudo certbot certonly --webroot -w /var/www/newdomain.com/html -d newdomain.com -d www.newdomain.com

Follow the prompts. Certificates auto-renew every 90 days.

Configure SSL in OpenLiteSpeed:

Get admin password:

bash

cat /usr/local/lsws/adminpasswd

Access WebAdmin at https://your_droplet_ip:7080:

  1. Go to ListenersSSL (port 443)
  2. Add your domain mapping
  3. Configure SSL certificate paths: /etc/letsencrypt/live/newdomain.com/

Quick Reference Commands

Find MySQL Password:

bash

cat /var/www/html/wp-config.php | grep DB_PASSWORD

Check OpenLiteSpeed Status:

bash

sudo systemctl status lsws

View Error Logs:

bash

sudo tail -50 /usr/local/lsws/logs/error.log
sudo tail -50 /var/www/newdomain.com/logs/error.log

Test Domain:

bash

curl -I http://newdomain.com

Check PHP Version:

bash

ls -la /usr/local/lsws/lsphp*/bin/php

Restart OpenLiteSpeed:

bash

sudo /usr/local/lsws/bin/lswsctrl restart

Troubleshooting

404 Not Found

Check listener mapping:

bash

grep -A 5 "listener.*80" /usr/local/lsws/conf/httpd_config.conf

Verify virtual host:

bash

grep -A 7 "virtualhost newdomain" /usr/local/lsws/conf/httpd_config.conf

Restart:

bash

sudo /usr/local/lsws/bin/lswsctrl restart

403 Forbidden

Fix permissions:

bash

sudo chown -R www-data:www-data /var/www/newdomain.com
sudo chmod -R 755 /var/www/newdomain.com
sudo find /var/www/newdomain.com/html/ -type f -exec chmod 644 {} \;
sudo find /var/www/newdomain.com/html/ -type d -exec chmod 755 {} \;
sudo /usr/local/lsws/bin/lswsctrl restart

Database Connection Error

Verify database exists:

bash

sudo mysql -u wordpress -p

sql

SHOW DATABASES;
EXIT;

Check wp-config.php:

bash

cat /var/www/newdomain.com/html/wp-config.php | grep -E "DB_NAME|DB_USER|DB_PASSWORD"

Verify:

  • DB_NAME matches database name
  • DB_USER is ‘wordpress’
  • DB_PASSWORD matches MySQL password

PHP Files Downloading

Check PHP version matches config:

bash

ls -la /usr/local/lsws/lsphp*/bin/php

Edit vhconf.conf:

bash

sudo nano /usr/local/lsws/conf/vhosts/newdomain/vhconf.conf

Ensure lsphp83 (or lsphp84) matches your installed version in both:

  • scripthandler section
  • extprocessor section

Restart:

bash

sudo /usr/local/lsws/bin/lswsctrl restart

Domain Not Resolving

Check DNS:

bash

ping newdomain.com

If it doesn’t show your droplet IP:

  1. Go to your domain registrar
  2. Update A record: @ → your droplet IP
  3. Update A record: www → your droplet IP
  4. Wait 5-60 minutes for propagation

Resource Management: DigitalOcean Multiple Websites on One Droplet

Droplet capacity guide:

  • 1GB RAM: 2-3 low-traffic sites
  • 2GB RAM: 4-6 sites with moderate traffic
  • 4GB RAM: 8-12 active sites
  • 8GB+ RAM: 15+ sites

Monitor resources:

bash

free -h        # Memory usage
df -h          # Disk usage
top            # Server load (press 'q' to exit)

Frequently Asked Questions

Do all WordPress sites share the same database?

No. Each site has its own database:

  • Site 1: wordpress database
  • Site 2: newdomain_wp database
  • Site 3: thirdsite_wp database

All sites use the same MySQL username (wordpress) and password, but each accesses only its own database.

Can I use different domain registrars?

Yes. Domains can be from any registrar. Just point each domain’s DNS A record to your droplet’s IP address.

How do WordPress updates work?

Each installation is independent. Updates must be done separately for each site. Installing a plugin on one site doesn’t affect others.


Best Practices

Security

  • Use strong, unique passwords for each WordPress admin
  • Keep WordPress, plugins, and themes updated on all sites
  • Install SSL certificates on all domains
  • Use a security plugin (Wordfence, Sucuri) on each site
  • Add to wp-config.php: define('DISALLOW_FILE_EDIT', true);

Backups

Each site needs its own backup:

bash

# Manual database backup
mysqldump -u wordpress -p newdomain_wp > newdomain_backup_$(date +%Y%m%d).sql

# Manual files backup
tar -czf newdomain_files_$(date +%Y%m%d).tar.gz /var/www/newdomain.com/html

Better: Install a WordPress backup plugin (UpdraftPlus, BackWPup) on each site.

Performance

  • Install LiteSpeed Cache plugin on each site
  • Optimize images before uploading
  • Use a CDN for high-traffic sites (Cloudflare free tier)
  • Monitor resources: htop (install: sudo apt install htop)

Conclusion

You can now run multiple WordPress sites on one server, saving hosting costs and simplifying management. Configuring OpenLiteSpeed multiple domains on a single droplet is a valuable skill that gives you flexibility to launch new projects quickly. Each new site takes 15-20 minutes to set up.

Next Steps

  1. Set up automated backups for all sites
  2. Configure email using SendGrid or Mailgun
  3. Implement monitoring with UptimeRobot
  4. Optimize performance with caching
  5. Harden security with fail2ban

Bookmark this guide for future reference.

Leave a Reply

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