Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- ########## nginx, mysql, php-fpm ,XCache ##########
- ##################S3Linux##################
- #########################################
- maxproc=`grep processor /proc/cpuinfo | wc -l`
- maxcon=`ulimit -n`
- gzipconf="gzip on;\n
- gzip_comp_level 9;\n
- gzip_http_version 1.1;\n
- gzip_proxied any;\n
- gzip_min_length 10;\n
- gzip_buffers 16 8k;\n
- gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript application/xhtml+xml;\n\n
- # Disable for IE < 6 because there are some known problems\n
- gzip_disable “MSIE [1-6].(?!.*SV1)”;\n\n
- # Add a vary header for downstream proxies to avoid sending cached gzipped files to IE6\n
- gzip_vary on;\n
- }"
- rpm -Uvh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
- rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
- yum install -y nginx phpMyAdmin php-fpm mysql mysql-devel mysql-server php-mysql php-xcache xcache-admin
- service mysqld restart
- read -p "Please enter your mysqlpassword: " sqlpass
- mysqladmin -u root password $sqlpass
- mv /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf.old
- while true; do
- read -p "Does your website uses SSL(yes/no)? " qssl
- case $qssl in
- [Yy]* ) curl -s http://pastebin.com/raw.php?i=uypDG7Qb >> /etc/nginx/conf.d/default.conf; break;;
- [Nn]* ) curl -s http://pastebin.com/raw.php?i=kkhqYt9a >> /etc/nginx/conf.d/default.conf; break;;
- * ) echo "Answer yes or no";;
- esac
- done
- read -p "Please enter your domain name: " domainname
- sed -i -e 's/domain.com/'$domainname'/g' /etc/nginx/conf.d/default.conf
- sed -i -e 's/group = apache/group = nginx/g' /etc/php-fpm.d/www.conf
- sed -i -e 's/user = apache/user = nginx/g' /etc/php-fpm.d/www.conf
- sed -i -e "s/worker_processes 1;/worker_processes $maxproc;/g" /etc/nginx/nginx.conf
- sed -i -e "s/ worker_connections 1024;/ worker_connections $maxcon;/g" /etc/nginx/nginx.conf
- sed -i '$s/}//' /etc/nginx/nginx.conf
- echo -e $gzipconf >> /etc/nginx/nginx.conf
- sed -i -e 's/; cgi.fix_pathinfo=1/ cgi.fix_pathinfo=0/g' /etc/php.ini
- ln -sf /usr/share/phpMyAdmin /usr/share/nginx/html/
- mkdir /var/lib/php/session
- chmod 0777 /var/lib/php/session
- chown -R nginx:nginx /var/lib/php/session
- service nginx restart
- service php-fpm restart
- while true; do
- read -p "Would you like nginx, mysql, php-fpm would autostart(yes/no)? " qautostart
- case $qautostart in
- [Yy]* ) chkconfig --levels 235 mysqld on && chkconfig --levels 235 nginx on && chkconfig --levels 235 php-fpm on; break;;
- [Nn]* ) break;;
- * ) echo "Answer yes or no";;
- esac
- done
- echo Done;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement