Last active
March 31, 2020 20:15
-
-
Save EricSeastrand/695aedfc179b0eba895c7ed560d7a0ed to your computer and use it in GitHub Desktop.
Install PHPMyAdmin on an AWS Elastic Beanstalk EC2 instance
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## To install, log into the server, download this file, and run as webapp user like: | |
# sudo -u webapp bash pma_install.sh | |
ALLOWED_IP='' # Put your public IP here... See whatismyip.com | |
PMA_VERSION=4.9.5 | |
PMA_FILE="phpMyAdmin-$PMA_VERSION-english" | |
INSTALL_IN_DIR='pma' | |
cd /var/www/html | |
rm -rf $INSTALL_IN_DIR | |
mkdir $INSTALL_IN_DIR | |
cd $INSTALL_IN_DIR | |
wget https://files.phpmyadmin.net/phpMyAdmin/$PMA_VERSION/$PMA_FILE.zip | |
unzip $PMA_FILE.zip | |
rm -f $PMA_FILE.zip | |
cat << HTACCESS >> .htaccess | |
order deny,allow | |
deny from all | |
allow from $ALLOWED_IP | |
RedirectMatch 301 ^/$INSTALL_IN_DIR/?$ /$INSTALL_IN_DIR/$PMA_FILE | |
HTACCESS | |
cd $PMA_FILE | |
# Here we set a config file that uses variables ElasticBeanstalk sets for us... | |
cat <<'CONFIG' > config.inc.php | |
<?php | |
$i=0; | |
$i++; | |
$cfg['Servers'][$i]['host'] = $_SERVER['RDS_HOSTNAME']; | |
$cfg['Servers'][$i]['user'] = $_SERVER['RDS_USERNAME']; | |
$cfg['Servers'][$i]['password'] = $_SERVER['RDS_PASSWORD']; // use here your password | |
$cfg['Servers'][$i]['auth_type'] = 'config'; | |
?> | |
CONFIG |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment