![]() |
|
Nginx, PHP and MySQL Installation Script - Printable Version +- Sinisterly (https://sinister.ly) +-- Forum: Computers (https://sinister.ly/Forum-Computers) +--- Forum: Software & Programs (https://sinister.ly/Forum-Software-Programs) +--- Thread: Nginx, PHP and MySQL Installation Script (/Thread-Nginx-PHP-and-MySQL-Installation-Script) |
Nginx, PHP and MySQL Installation Script - Oni - 08-31-2013 A while back a dal33t showed me a simple script he made to automatically install Nginx, PHP and MySQL (for Debian Squeeze). Just thought it might be worth sharing if any of you bought a VPS. Simple, saves a few minutes of time, and I found it useful when I was helping a friend. Code: #! /bin/sh
##############################################
# chkconfig: 2345 90 10 #
# Installer - makes server ready for use #
##############################################
if [[ $# != 1 ]]
then echo "Nginx, PHP5 and MySQL installer by DaL33T"
echo "Arguments: sh installer.sh <website URL w/o www.>"
exit 0
fi
echo "[*] Installing..."
apt-get update
#Install nano
echo "[*] Installing Nano..."
apt-get install -qq --force-yes nano
#Install nginx
echo "[*] Installing Nginx..."
wget http://nginx.org/keys/nginx_signing.key
apt-key add nginx_signing.key
rm nginx_signing.key
echo "deb http://nginx.org/packages/debian/ squeeze nginx" | sh -c 'cat >> /etc/apt/sources.list'
echo "deb-src http://nginx.org/packages/debian/ squeeze nginx" | sh -c 'cat >> /etc/apt/sources.list'
apt-get update
service apache2 stop
apt-get install -qq --force-yes nginx
cd /etc/nginx/conf.d
rm -rf *
echo "server {
listen 80;
server_name www.$1 $1;
location / {
root /var/www;
index index.html index.htm index.php;
}
location ~ \.php$ {
root /var/www;
fastcgi_pass unix:/tmp/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;
include fastcgi_params;
}
}" | sh -c 'cat >> default.conf'
#Install mysql
echo "[*] Installing MySQL..."
apt-get install -qq --force-yes mysql-server mysql-client
#Install php5
echo "[*] Installing PHP5..."
echo "deb http://packages.dotdeb.org squeeze all" | sh -c 'cat >> /etc/apt/sources.list'
echo "deb-src http://packages.dotdeb.org squeeze all" | sh -c 'cat >> /etc/apt/sources.list'
wget http://www.dotdeb.org/dotdeb.gpg
cat dotdeb.gpg | apt-key add -
rm dotdeb.gpg
apt-get update
apt-get install -qq --force-yes php5-fpm php5-mysql php5-curl php5-gd php5-intl php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl
/etc/init.d/php5-fpm restart
sed -i 's/127.0.0.1:9000/\/tmp\/php5-fpm.sock/g' /etc/php5/fpm/pool.d/www.conf
#Restart nginx/php-fpm
echo "[*] Finishing up..."
service nginx restart
/etc/init.d/php5-fpm restart
echo ""
echo "################################################"
echo "# Nginx, MySQL and PHP5 have been installed on #"
echo "# this server. Thanks for using my script! #"
echo "# #"
echo "# -DaL33T #"
echo "################################################"
exit 0RE: Nginx, PHP and MySQL Installation Script - Cyanide and Cynicism - 09-14-2013 cool but who the fuck uses MySQL RE: Nginx, PHP and MySQL Installation Script - Oni - 09-14-2013 (09-14-2013, 09:29 PM)Cyanide and Cynicism Wrote: cool but who the fuck uses MySQL Cool people. RE: Nginx, PHP and MySQL Installation Script - Cyanide and Cynicism - 09-14-2013 (09-14-2013, 09:33 PM)Oni Wrote: Cool people. Postgre pls. RE: Nginx, PHP and MySQL Installation Script - Lain - 09-15-2013 (09-14-2013, 09:36 PM)Cyanide and Cynicism Wrote: Postgre pls.Psshk, SQLite pls. RE: Nginx, PHP and MySQL Installation Script - SQLi - 09-15-2013 Thanks for this. It's much appreciated. RE: Nginx, PHP and MySQL Installation Script - Cyanide and Cynicism - 09-15-2013 you should change Code: #! /bin/shto Code: #!/usr/bin/env bashhooray for proper shebangs |