Skip to content

Instantly share code, notes, and snippets.

@thosuperman
Forked from thodeveloper/Amazon-Linux-AMI PHP55
Last active May 12, 2017 07:16
Show Gist options
  • Save thosuperman/5cbcbbc486283826b4fd to your computer and use it in GitHub Desktop.
Save thosuperman/5cbcbbc486283826b4fd to your computer and use it in GitHub Desktop.
:: UPDATE YUM ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
sudo yum update -y
:: INSTALL WEBSERVER :::::::::::::::::::::::::::::::::::::::::::::::::::::::::
sudo yum install httpd24
sudo service httpd start
sudo chkconfig httpd on
chkconfig --list httpd
:: CONFIGURE HTTPD :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
sudo nano /etc/httpd/conf/httpd.conf
<Directory "/var/www/html">
Options All
AllowOverride All
Require all granted
</Directory>
:: CONFIGURE VHOSTS ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
sudo nano /etc/httpd/conf.d/vhosts.conf
<create log and vhost folders in html>
<VirtualHost *:80>
ServerName localhost
DocumentRoot "/var/www/html"
ErrorLog "/var/www/html/logs/error_log"
CustomLog "/var/www/html/logs/access_log" combined
<Directory "/var/www/html">
Options All
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName www.other-site.com
ServerAlias *.other-site.com
DocumentRoot "/var/www/html/www.other-site.com"
ErrorLog "/var/www/html/www.other-site.com/logs/error_log"
CustomLog "/var/www/html/www.other-site.com/logs/access_log" combined
<Directory "/var/www/html/www.other-site.com">
Options All
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
:: ADD EC2 USER TO WWW :::::::::::::::::::::::::::::::::::::::::::::::::::::::
ls -l /var/www
sudo groupadd www
sudo usermod -a -G www ec2-user
<exit>
<login>
groups
sudo chown -R root:www /var/www
sudo chmod 2775 /var/www
find /var/www -type d -exec sudo chmod 2775 {} +
find /var/www -type f -exec sudo chmod 0664 {} +
:: ADD APACHE USER TO WWW :::::::::::::::::::::::::::::::::::::::::::::::::::::::
sudo usermod -a -G www apache
<also change the apache config to use apache:www>
:: INSTALL MYSQL :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
sudo yum localinstall http://repo.mysql.com/mysql-community-release-el6-7.noarch.rpm
sudo yum install mysql-community-server
sudo service mysqld start
sudo /usr/bin/mysql_secure_installation
<enter>
<new-pass>
<new-pass>
<Y>
<Y>
<Y>
<Y>
sudo chkconfig mysqld on
:: INSTALL PHP 5.5 WITH MYSQL AND SOME BASICS ::::::::::::::::::::::::::::::::
sudo yum install php55 php55-devel php55-common php55-cli php55-pecl-apc php55-pdo php55-mysql php55-xml php55-gd php55-mbstring php-pear php55-mysqlnd php55-mcrypt
sudo service httpd restart
echo "<?php phpinfo(); ?>" > /var/www/html/phpinfo.php
:: EDIT PHP.INI ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
sudo nano /etc/php.ini
expose_php = Off
error_log = /var/log/php-error.log
date.timezone = "America/Chicago"
sudo service httpd restart
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
yum --enablerepo=remi,remi-test install phpMyAdmin
Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin
## Comment below section to allow everyone
<Directory /usr/share/phpMyAdmin/>
<IfModule !mod_authz_core.c>
Order Deny,Allow
Deny from All
Allow from 192.168.1.0/24
Allow from ::1
</IfModule>
</Directory>
<Directory /usr/share/phpMyAdmin/libraries/>
Order Deny,Allow
Deny from All
Allow from None
</Directory>
<Directory /usr/share/phpMyAdmin/setup/lib/>
Order Deny,Allow
Deny from All
Allow from None
</Directory>
<Directory /usr/share/phpMyAdmin/setup/frames/>
Order Deny,Allow
Deny from All
Allow from None
</Directory>
@pcriss040258
Copy link

if you watching this you can login your stuff and your account.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment