Skip to content

Instantly share code, notes, and snippets.

@lukrizal
Forked from majimboo/Linux_Nginx_MySQL_PHP5.sh
Last active August 29, 2015 14:13
Show Gist options
  • Save lukrizal/4f9e239a3d658ef5b7e9 to your computer and use it in GitHub Desktop.
Save lukrizal/4f9e239a3d658ef5b7e9 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Install script for LEMP Web Server on CENTOS 6.5 by Majid Arif Siddiqui
# Init
echo "Initializing..."
sudo yum -y update
sudo yum -y groupinstall "Development Tools"
sudo yum -y install screen
# Install the Required Repositories
echo "Installing the Required Repositories..."
sudo rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
# Install MySQL (not used)
echo "Installing MySQL..."
sudo yum install -y mysql mysql-server
# Install Nginx
echo "Installing Nginx..."
sudo yum install -y nginx
# Install PHP
echo "Installing PHP..."
sudo yum --enablerepo=remi install -y php-fpm php-mysql php-cli php-mcrypt
# Install Composer
echo "Installing Composer globally..."
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/bin/composer
# Install git
echo "Installing git version management"
sudo yum install -y git
# Install NodeJS
echo "Installing Nodejs..."
cd /usr/src
wget http://nodejs.org/dist/v0.10.26/node-v0.10.26.tar.gz
tar zxf node-v0.10.26.tar.gz
cd node-v0.10.26
./configure
make
make install
cd ~/
# Restarting Services
echo "Restarting Services..."
# sudo service mysqld restart
sudo service php-fpm restart
sudo service nginx restart
# Set Up Autostart
echo "Setting Autostart..."
# sudo chkconfig --levels 235 mysqld on
sudo chkconfig --levels 235 nginx on
sudo chkconfig --levels 235 php-fpm on
# Configure PHP
echo "Configuring PHP..."
sudo sed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g' /etc/php.ini
sudo sed -i 's/user = apache/user = nginx/g' /etc/php-fpm.d/www.conf
sudo sed -i 's/group = apache/group = nginx/g' /etc/php-fpm.d/www.conf
# Configure Nginx for PHP
echo "Configuring Nginx for PHP..."
sudo sed -i 's/index index.html index.htm;/index index.php index.html index.htm;/g' /etc/nginx/conf.d/default.conf
# Done
echo "Done done suy!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment