Install wordpress
Mount disk in ubuntu with aws volume
08/08/2016
Install wordpress
WordPress SEO Improvements
26/08/2016
Show all

Multi Sites WordPress on ec2 ubuntu 12

Install wordpress

Create EC2 and:

cd /var/tmp/
wget https://www.yanivp.net/01.sh
bash 01.sh

one command:

cd /var/tmp/ && wget https://www.yanivp.net/01.sh && bash 01.sh

cd /var/tmp/
sudo wget http://wordpress.org/latest.tar.gz
sudo tar -zxvf latest.tar.gz

Create Alias:

cd ~
alias ltmp="cd /var/tmp"
alias lweb="cd /var/www/html"
alias ll="ls -al"

one command:

cd ~ && alias lt="cd /var/tmp" && alias lweb="cd /var/www/html" && sudo sed -i '/for examples/aalias ltmp="cd /var/tmp"' ~/.bashrc && sudo sed -i '/for examples/aalias lweb="cd /var/www/html"' ~/.bashrc && cd ~/ && sudo sed -i '/for examples/aalias ll="ls -al"' ~/.bashrc && cd ~/ && source .bashrc

Create new database, db user and password:

mysql -u root -p

CREATE DATABASE site1_db;
CREATE DATABASE site2_db;
CREATE DATABASE site3_db;

CREATE USER usersite1@localhost;
CREATE USER usersite2@localhost;
CREATE USER usersite3@localhost;

SET PASSWORD FOR usersite1@localhost= PASSWORD("password1");
SET PASSWORD FOR usersite2@localhost= PASSWORD("password2");
SET PASSWORD FOR usersite3@localhost= PASSWORD("password3");

GRANT ALL PRIVILEGES ON site1_db.* TO usersite1@localhost IDENTIFIED BY 'password1';
GRANT ALL PRIVILEGES ON site2_db.* TO usersite2@localhost IDENTIFIED BY 'password2';
GRANT ALL PRIVILEGES ON site3_db.* TO usersite3@localhost IDENTIFIED BY 'password3';

FLUSH PRIVILEGES;

exit

DELETE web from html  sudo rm -rf /var/www/html/*

sudo mkdir /var/www/html/site-1.com
sudo mkdir /var/www/html/site-2.com
sudo mkdir /var/www/html/site-3.com

sudo cp -avr /var/tmp/wordpress/* /var/www/html/site-1.com

cd /var/www/html/
sudo chown www-data:www-data * -R
sudo usermod -a -G www-data ubuntu
sudo chown www-data:www-data * -R .htaccess

cd /etc/apache2/sites-available

sudo cp 000-default.conf site-1.com.conf

sudo nano site-1.com.conf AND change the ServerName & ServerAdmin & DocumentRoot

add ServerAlias www.site-1.co.il for redirect from www


sudo apt-get install php5-gd
sudo a2ensite site-1.com
sudo service apache2 reload
cd /var/www/html/site-1.com/
sudo nano wp-config.php AND change the DB_name \  DB_user \ DB_PASSWORD 

go to http://site-1.com

Disable index of

sudo sed -i 's/Options Indexes FollowSymLinks/Options -Indexes'/g /etc/apache2/apache2.conf && sudo service apache2 restart



 

Reference: https://www.yanivp.net//www.digitalocean.com/community/tutorials/how-to-set-up-multiple-wordpress-sites-on-a-single-ubuntu-vps

Leave a Reply

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