lamp 脚本

第一个脚本,用作学习规范和学习命(centos6.x):

#!/bin/bash
#-----------------------------------
#description:	install lamp
#
#version:	1.0
#
#author:	zhuyu
#
#-----------------------------------

#prepare

core=`cat /proc/cpuinfo |grep "processor" |wc -l`

yum -y install httpd mysql-server mysql php php-mysql php-gd libjpeg* php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-bcmath mhash libmcrypt

#-----------------------------------
#configure httpd

/bin/sed -i 's/ServerTokens OS/ServerTokens Prod/g' /etc/httpd/conf/httpd.conf

/bin/sed -i 's/ServerSignature On/ServerSignature Off/g' /etc/httpd/conf/httpd.conf

/bin/sed -i 's/Options Indexes FollowSymLinks/Options Includes ExecCGI FollowSymLinks/g' /etc/httpd/conf/httpd.conf

/bin/sed -i 's/AddHandler cgi-script .cgi/AddHandler cgi-script .cgi .pl/g' /etc/httpd/conf/httpd.conf

/bin/sed -i 's/AllowOverride None/AllowOverride All/g' /etc/httpd/conf/httpd.conf

/bin/sed -i 's/Options Indexes MultiViews FollowSymLinks/Options MultiViews FollowSymLinks/g' /etc/httpd/conf/httpd.conf

/bin/sed -i 's/DirectoryIndex index.html index.html.var/DirectoryIndex index.html index.html.var index.php/g' /etc/httpd/conf/httpd.conf

/bin/sed -i 's/KeepAlive Off/KeepAlive On/g'  /etc/httpd/conf/httpd.conf

/bin/sed -i 's/MaxKeepAliveRequests 100/MaxKeepAliveRequests 1000/g' /etc/httpd/conf/httpd.conf



#configure mysqld

/bin/cp -f /usr/share/mysql/my-huge.cnf /etc/my.cnf 

sed -i "s/thread_concurrency = 8/thread_concurrency = `expr 2 \* $core`/g" /etc/my.cnf

service mysqld restart 

mysqladmin -u root password 'qwe123'

#configure php

sed -i 's/post_max_size = 8M/post_max_size = 50M/g' /etc/php.ini

sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 50M/g' /etc/php.ini

sed -i 's/;date.timezone =/date.timezone = PRC/g' /etc/php.ini

sed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g' /etc/php.ini

sed -i 's/max_execution_time = 30/max_execution_time = 300/g' /etc/php.ini

sed -i 's/disable_functions =.*/disable_functions =passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,popen,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server/g' /etc/php.ini

rm -rf /etc/httpd/conf.d/welcome.conf
rm -rf /var/www/error/noindex.html

echo -e "<?php\nphpinfo();\n?>" >> /var/www/html/index.php

chkconfig httpd on
chkconfig mysqld on
service httpd restart
service mysqld restart

  

posted @ 2017-03-14 09:14  feral  阅读(332)  评论(1编辑  收藏  举报