How to run multiple website on ubuntu without any control panel.

First update your system packages :

    apt-get update -y && apt-get upgrade -y

Now install wget :

    apt-get install wget -y

Download latest version of wordpress :


Now extract wordpress tar file :

      tar xzvf latest.tar.gz

Create multiple user & databse for each user :

      mysql -u root -p (if need install mysql or mariadb)
      CREATE DATABASE Database1;
      CREATE DATABASE Database2;
      CREATE USER User1@localhost;
      CREATE USER User2@localhost;

Set password for each user :

      SET PASSWORD FOR User1@localhost=PASSWORD("Password1");
      SET PASSWORD FOR User2@localhost= PASSWORD("Password2");

Now grant all privileges to all users ot database :

      GRANT ALL PRIVILEGES ON Database1.* TO User@localhost IDENTIFIED BY 'Password1';
      GRANT ALL PRIVILEGES ON Database2.* TO User2@localhost IDENTIFIED BY 'Password2';

Now flush the privilages to work all user with database properly & exit from mysql mode :


Now go to www directory & create your sites directory :

        cd /var/www
        mkdir Site1
        mkdir Site2

Copy wp-config-sample.php file to wp-config.php :

        cp ~/wordpress/wp-config-sample.php ~/wordpress/wp-config.php

Now sync wordpress files to your sites :

        rsync -avP ~/wordpress/ /var/www/Site1/
        rsync -avP ~/wordpress/ /var/www/Site2/

Change file ownership of www-data :

        sudo chown www-data:www-data * -R

Now go to your site1 directory & edit wp-config.php file :

        cd /var/www/Site1
        sudo nano wp-config.php

Change the database & user name as you created :

        define('DB_NAME', 'Database1');
        define('DB_USER', 'User1');
        define('DB_PASSWORD', 'Password1');

Save and exit. (repeat for other sites)

Now go to sites-available directory :

        cd /etc/httpd/sites-available

Copy default file content to Site1 file :

        cp default Site1

Edit your Site1 file :

        nano Site1

Add the virtualhost block to Site1 file :

<VirtualHost *:80>
	ServerAdmin your_email_address
	DocumentRoot /var/www/Site1
<Directory />
    Options FollowSymLinks
    AllowOverride None
<Directory /var/www/Site1>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    allow from all

Now install php to execute php files :

    apt-get install php5-gd -y (install php version as you choose)

Enable your Site1 :

    a2ensite Site1 (repeat for other sites)

You must need to restart http service to work all configuration :

    systemctl restart httpd

Browse your sites now.

Thank you for reading this article.

Was this helpful?

1 / 0

Leave a Reply 6

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



The best solution, thanks



Hi,awesome article,thanks



Cool! please keep it continue.



Hi, look what a cool site I found



Hi, look what a cool site I found, there you can you can learn

Maddox Newman

Maddox Newman

Hi there! I just wanted to ask if you ever have any problems with hackers? My last blog (wordpress) was hacked and I ended up losing many months of hard work due to no back up. Do you have any solutions to protect against hackers?