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

  

转载于:https://www.cnblogs.com/feral/p/6546744.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值