Advertisement
Guest User

Untitled

a guest
Apr 11th, 2016
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.65 KB | None | 0 0
  1. #!/bin/bash
  2. ########## nginx, mysql, php-fpm ,XCache ##########
  3. ##################S3Linux##################
  4. #########################################
  5. maxproc=`grep processor /proc/cpuinfo | wc -l`
  6. maxcon=`ulimit -n`
  7. gzipconf="gzip on;\n
  8. gzip_comp_level 9;\n
  9. gzip_http_version 1.1;\n
  10. gzip_proxied any;\n
  11. gzip_min_length 10;\n
  12. gzip_buffers 16 8k;\n
  13. gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript application/xhtml+xml;\n\n
  14.  
  15. # Disable for IE < 6 because there are some known problems\n
  16. gzip_disable “MSIE [1-6].(?!.*SV1)”;\n\n
  17.  
  18. # Add a vary header for downstream proxies to avoid sending cached gzipped files to IE6\n
  19. gzip_vary on;\n
  20. }"
  21. rpm -Uvh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
  22. rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
  23. yum install -y nginx phpMyAdmin php-fpm mysql mysql-devel mysql-server php-mysql php-xcache xcache-admin
  24. service mysqld restart
  25. read -p "Please enter your mysqlpassword: " sqlpass
  26. mysqladmin -u root password $sqlpass
  27. mv /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf.old
  28.  
  29. while true; do
  30. read -p "Does your website uses SSL(yes/no)? " qssl
  31. case $qssl in
  32. [Yy]* ) curl -s http://pastebin.com/raw.php?i=uypDG7Qb >> /etc/nginx/conf.d/default.conf; break;;
  33. [Nn]* ) curl -s http://pastebin.com/raw.php?i=kkhqYt9a >> /etc/nginx/conf.d/default.conf; break;;
  34. * ) echo "Answer yes or no";;
  35. esac
  36. done
  37.  
  38. read -p "Please enter your domain name: " domainname
  39. sed -i -e 's/domain.com/'$domainname'/g' /etc/nginx/conf.d/default.conf
  40. sed -i -e 's/group = apache/group = nginx/g' /etc/php-fpm.d/www.conf
  41. sed -i -e 's/user = apache/user = nginx/g' /etc/php-fpm.d/www.conf
  42. sed -i -e "s/worker_processes 1;/worker_processes $maxproc;/g" /etc/nginx/nginx.conf
  43. sed -i -e "s/ worker_connections 1024;/ worker_connections $maxcon;/g" /etc/nginx/nginx.conf
  44. sed -i '$s/}//' /etc/nginx/nginx.conf
  45. echo -e $gzipconf >> /etc/nginx/nginx.conf
  46. sed -i -e 's/; cgi.fix_pathinfo=1/ cgi.fix_pathinfo=0/g' /etc/php.ini
  47. ln -sf /usr/share/phpMyAdmin /usr/share/nginx/html/
  48. mkdir /var/lib/php/session
  49. chmod 0777 /var/lib/php/session
  50. chown -R nginx:nginx /var/lib/php/session
  51. service nginx restart
  52. service php-fpm restart
  53. while true; do
  54. read -p "Would you like nginx, mysql, php-fpm would autostart(yes/no)? " qautostart
  55. case $qautostart in
  56. [Yy]* ) chkconfig --levels 235 mysqld on && chkconfig --levels 235 nginx on && chkconfig --levels 235 php-fpm on; break;;
  57. [Nn]* ) break;;
  58. * ) echo "Answer yes or no";;
  59. esac
  60. done
  61. echo Done;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement