http://docs.aws.amazon.com/AmazonVPC/latest/GettingStartedGuide/GetStarted.html
phpMyAdmin
Type | Protocol | Port Range | Destination |
---|---|---|---|
SSH | TCP | 22 | 0.0.0.0/0 |
HTTP | TCP | 80 | 0.0.0.0/0 |
Assign phpMyAdmin
to the new EC2 instance and visit
http://YOUR_SERVER_IP
chmod 400 key.pem
ssh -i key.pem ec2-user@YOUR_SERVER_IP
sudo -i
yum -y update
yum install -y gcc make gcc-c++
yum install -y php55-mysqlnd php55 php55-xml php55-mcrypt php55-mbstring php55-cli mysql55 mysql55-server httpd24
-y
will tell yum to say yes to all questions.
service httpd start
service mysqld start
/usr/bin/mysqladmin -u root password SUPERSECUREPASSWORD
cd /etc/rc.d/rc3.d
rm K15httpd
rm K36mysqld
ln -s ../init.d/mysqld S30mysql
ln -s ../init.d/httpd S85httpd
cd /var/www/html
wget https://files.phpmyadmin.net/phpMyAdmin/4.4.13.1/phpMyAdmin-4.4.13.1-english.tar.gz
tar -xzvf phpMyAdmin-4.4.13.1-english.tar.gz -C /var/www/html
mv phpMyAdmin-4.4.13.1-english phpmyadmin
rm -rf phpMyAdmin-4.4.13.1-english.tar.gz
check for updates: https://www.phpmyadmin.net/downloads/
We now need to add permission for this folder, find the user group (should be apache) with this command:
egrep 'User|Group' /etc/httpd/conf/httpd.conf
Which will return:
User apache
Group apache
And last, run this command to associate that user with the phpmyadmin folder:
chown -R apache.apache phpmyadmin/
cd /var/www/html/phpmyadmin/
cp config.sample.inc.php config.inc.php
mkdir config
chmod o+rw config
cp config.sample.inc.php config/config.inc.php
chmod o+w config/config.inc.php
nano /var/www/html/phpmyadmin/config.inc.php
$cfg['blowfish_secret'] = '{^QP+-(3mlHy+Gd~FE3mN{gIATs^1lX+T=KVYv{ubK*U0V';
reference: http://www.question-defense.com/tools/phpmyadmin-blowfish-secret-generator
service httpd restart
http://YOUR_SERVER_IP/phpmyadmin/index.php
with username root
password SUPERSECUREPASSWORD
rm -rf config
Setup RDS with username awsuser
password mypassword
rds
Type | Protocol | Port Range | Source |
---|---|---|---|
MYSQL/Aurora | TCP | 3306 | sg-abcdefgh (phpMyAdmin) |
nano /var/www/html/phpmyadmin/config.inc.php
$cfg['Servers'][$i]['host'] = 'mydbinstance.abcdefghijkl.us-east-1.rds.amazonaws.com:3306'
http://YOUR_SERVER_IP/phpmyadmin/index.php
with username awsuser
password mypassword
nano /var/www/html/info.php
<?php phpinfo(); ?>
http://YOUR_SERVER_IP/info.php
nano /var/www/html/db_test.php
<?php
$link = mysqli_connect('mydbinstance.abcdefghijkl.us-east-1.rds.amazonaws.com', 'awsuser', 'mypassword', 'information_schema', 3306);
var_dump($link);
<?php
$link = mysqli_connect('localhost', 'root', 'SUPERSECUREPASSWORD', 'information_schema');
var_dump($link);
http://YOUR_SERVER_IP/db_test.php
#Git Deploy https://gist.github.com/oodavid/1809044
How do I create an ALIAS for phpmyadmin, for security reasons