Categories
AWS

Install Word Press In public and database In Private

Installing WordPress in Public Instance and Database in private Instance and access that database through public Instance .

This is for the Linux AMI

Start public , private and nat ec2 instances:

In public instance

Install Apache

sudo su

yum install httpd

service httpd start

Install MySQL

yum install mysql

service mysql or mysqld start

yum install php php-mysql

In private instance

sudo su

Install MySQL-Server

yum install mysql-server

sudo /sbin/service mysqld start

mysql_secure_installtion

mysql -u root -p

CREATE DATABASE wordpress;

CREATE USER wordpressuser@public (check)-instance-ip IDENTIFIED BY ‘password’;

GRANT ALL PRIVILEGES ON wordpress.* TO wordpressuser@public-instance-ip(check) IDENTIFIED BY ‘password’;

FLUSH PRIVILEGES;

exit

In public instance

Install PHP

sudo yum install php-gd

sudo service httpd restart

Install WordPress

cd ~

wget http://wordpress.org/latest.tar.gz

tar xzvf latest.tar.gz

sudo rsync -avP ~/wordpress/ /var/www/html/

mkdir /var/www/html/wp-content/uploads

sudo chown -R apache:apache /var/www/html/*

cd /var/www/html

cp wp-config-sample.php wp-config.php

nano wp-config.php

modify:

define(‘DB_NAME’, ‘wordpress’);

/** MySQL database username */

define(‘DB_USER’, ‘wordpressuser’);

/** MySQL database password */

define(‘DB_PASSWORD’, ‘password’);

see this type something host might be written after password

/**host:->>>>> private-instance-ip *//

To see the OutPut

In browser

http://public-instance-ip

To check in public intance type

mysql -u root -p wordpress -h private_IP