Skip to content

Instantly share code, notes, and snippets.

@shobhitsinghal624
Last active January 30, 2016 06:44
Show Gist options
  • Save shobhitsinghal624/558fe4e0f37e7e242e56 to your computer and use it in GitHub Desktop.
Save shobhitsinghal624/558fe4e0f37e7e242e56 to your computer and use it in GitHub Desktop.
Wordpress Installation Scripts - New Ubuntu EC2 Instance
#! /usr/bin/env bash
cd ~
# Install LAMP
sudo apt-get install --assume-yes apache2 mysql-server php5 php5-mysql
# Install other needed stuff
sudo apt-get install --assume-yes wget dos2unix
# Install these php5 modules
sudo apt-get install --assume-yes php5-gd libssh2-php
# Enable mod_rewrite on apache
sudo a2enmod rewrite
sudo service apache2 restart
# Download the latest wordpress setup
cd /var/www
sudo wget http://wordpress.org/latest.tar.gz
sudo tar xzvf latest.tar.gz
sudo rm latest.tar.gz
# Create Wordpress config file
sudo dos2unix /var/www/wordpress/wp-config-sample.php
sudo cp /var/www/wordpress/wp-config-sample.php /var/www/wordpress/wp-config.php
sudo chown -R www-data:www-data /var/www/wordpress
# Change Apache Config
cd /etc/apache2/sites-available/
sudo wget https://gist.githubusercontent.com/shobhitsinghal624/558fe4e0f37e7e242e56/raw/wordpress.conf
cd /etc/apache2/sites-enabled/
sudo ln -s ../sites-available/wordpress.conf
sudo rm 000-default.conf
sudo service apache2 restart
<VirtualHost *:80>
#ServerAdmin webmaster@localhost
#ServerName domain.tld
#ServerAlias www.domain.tld
DocumentRoot /var/www/wordpress
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error-wordpress.log
CustomLog ${APACHE_LOG_DIR}/access-wordpress.log combined
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/wordpress>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
php_value date.timezone "Asia/Kolkata"
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment