Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save krishnakanthpps/4fc26518d04d10a287b39ee82d693b86 to your computer and use it in GitHub Desktop.

Select an option

Save krishnakanthpps/4fc26518d04d10a287b39ee82d693b86 to your computer and use it in GitHub Desktop.

Revisions

  1. @thosuperman thosuperman revised this gist Sep 22, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Amazon-Linux-AMI PHP70
    Original file line number Diff line number Diff line change
    @@ -84,7 +84,7 @@ sudo chkconfig mysqld on

    :: INSTALL PHP 7.0 WITH MYSQL AND SOME BASICS ::::::::::::::::::::::::::::::::

    sudo yum install php70 php70-gd php70-imap php70-mbstring php70-mysqlnd php70-opcache php70-pdo php70-pecl-apcu
    sudo yum install php70 php70-gd php70-imap php70-mbstring php70-mysqlnd php70-opcache php70-pdo php70-pecl-apcu php70-mcrypt
    sudo service httpd restart
    echo "<?php phpinfo(); ?>" > /var/www/html/phpinfo.php

  2. @thosuperman thosuperman revised this gist Aug 27, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Amazon-Linux-AMI PHP70
    Original file line number Diff line number Diff line change
    @@ -93,7 +93,7 @@ echo "<?php phpinfo(); ?>" > /var/www/html/phpinfo.php
    sudo nano /etc/php.ini
    expose_php = Off
    error_log = /var/log/php-error.log
    date.timezone = "America/Ho_Chi_Minh"
    date.timezone = "Asia/Ho_Chi_Minh"
    sudo service httpd restart

    :: INSTALL PHPMYADMIN ::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3. @thosuperman thosuperman revised this gist Jul 18, 2017. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions Amazon-Linux-AMI PHP70
    Original file line number Diff line number Diff line change
    @@ -117,6 +117,8 @@ sudo service httpd restart
    :: INSTALL letsencrypt ::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    sudo service httpd stop
    sudo service mysqld stop
    sudo su
    sudo yum install mod24_ssl
    yum install python27-devel git
    git clone https://github.com/letsencrypt/letsencrypt /opt/letsencrypt
    /opt/letsencrypt/letsencrypt-auto --debug
  4. @thosuperman thosuperman revised this gist Jul 18, 2017. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions Amazon-Linux-AMI PHP70
    Original file line number Diff line number Diff line change
    @@ -36,8 +36,8 @@ sudo nano /etc/httpd/conf.d/vhosts.conf
    <create log and vhost folders in html>

    <VirtualHost *:80>
    ServerName www.other-site.com
    ServerAlias *.other-site.com
    ServerName yourdomain.com
    ServerAlias www.yourdomain.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
  5. @thosuperman thosuperman revised this gist Jul 18, 2017. 1 changed file with 20 additions and 13 deletions.
    33 changes: 20 additions & 13 deletions Amazon-Linux-AMI PHP70
    Original file line number Diff line number Diff line change
    @@ -2,6 +2,16 @@

    sudo yum update -y

    :: MAKE SWAP :::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    sudo dd if=/dev/zero of=/swapfile bs=1024 count=1024k
    sudo su
    mkswap /swapfile
    swapon /swapfile
    swapon -s
    echo /swapfile none swap defaults 0 0 >> /etc/fstab
    chown root:root /swapfile
    chmod 0600 /swapfile

    :: INSTALL WEBSERVER :::::::::::::::::::::::::::::::::::::::::::::::::::::::::

    sudo yum install httpd24
    @@ -25,19 +35,6 @@ 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
    @@ -116,3 +113,13 @@ Listen 9000
    </VirtualHost>

    sudo service httpd restart

    :: INSTALL letsencrypt ::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    sudo service httpd stop
    sudo service mysqld stop
    yum install python27-devel git
    git clone https://github.com/letsencrypt/letsencrypt /opt/letsencrypt
    /opt/letsencrypt/letsencrypt-auto --debug

    sudo service httpd restart
    sudo service mysqld restart
  6. @thosuperman thosuperman revised this gist Jul 17, 2017. 1 changed file with 16 additions and 36 deletions.
    52 changes: 16 additions & 36 deletions Amazon-Linux-AMI PHP70
    Original file line number Diff line number Diff line change
    @@ -96,43 +96,23 @@ echo "<?php phpinfo(); ?>" > /var/www/html/phpinfo.php
    sudo nano /etc/php.ini
    expose_php = Off
    error_log = /var/log/php-error.log
    date.timezone = "America/Chicago"
    date.timezone = "America/Ho_Chi_Minh"
    sudo service httpd restart

    :: ADD KEY for TRANSMIT FTP ::::::::::::::::::::::::::::::::::::::::::::::::::
    :: INSTALL PHPMYADMIN ::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    sudo su
    cd /var/www && wget https://github.com/phpmyadmin/phpmyadmin/archive/RELEASE_4_6_6.zip && unzip RELEASE_4_6_6.zip && mv phpmyadmin-RELEASE_4_6_6 phpmyadmin && rm -rf RELEASE_4_6_6.zip
    sudo nano /etc/httpd/conf.d/phpmyadmin.conf

    <cd to directory with key>
    ssh-add [yourkey].pem

    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>
    Listen 9000
    <VirtualHost *:9000>
    DocumentRoot /var/www/phpmyadmin
    <Directory /var/www/phpmyadmin>
    # enable the .htaccess rewrites
    AllowOverride All
    Options All
    Require all granted
    </Directory>
    </VirtualHost>

    <Directory /usr/share/phpMyAdmin/setup/frames/>
    Order Deny,Allow
    Deny from All
    Allow from None
    </Directory>
    sudo service httpd restart
  7. @thosuperman thosuperman revised this gist Jul 17, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Amazon-Linux-AMI PHP70
    Original file line number Diff line number Diff line change
    @@ -87,7 +87,7 @@ sudo chkconfig mysqld on

    :: INSTALL PHP 7.0 WITH MYSQL AND SOME BASICS ::::::::::::::::::::::::::::::::

    sudo yum install php70 php70-devel php70-common php70-cli php70-pecl-apc php70-pdo php70-mysql php70-xml php70-gd php70-mbstring php-pear php70-mysqlnd php70-mcrypt
    sudo yum install php70 php70-gd php70-imap php70-mbstring php70-mysqlnd php70-opcache php70-pdo php70-pecl-apcu
    sudo service httpd restart
    echo "<?php phpinfo(); ?>" > /var/www/html/phpinfo.php

  8. Tony Nguyen created this gist Dec 6, 2016.
    138 changes: 138 additions & 0 deletions Amazon-Linux-AMI PHP70
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,138 @@
    :: 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 7.0 WITH MYSQL AND SOME BASICS ::::::::::::::::::::::::::::::::

    sudo yum install php70 php70-devel php70-common php70-cli php70-pecl-apc php70-pdo php70-mysql php70-xml php70-gd php70-mbstring php-pear php70-mysqlnd php70-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

    :: ADD KEY for TRANSMIT FTP ::::::::::::::::::::::::::::::::::::::::::::::::::

    <cd to directory with key>
    ssh-add [yourkey].pem

    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>