分类: LINUX
2009-09-17 20:51:01
CODE:
#vi init.sh -------------------cut begin------------------------------------------- #welcome cat << EOF +--------------------------------------------------------------+ | === Welcome to Centos System init === | +-------------- +----------------------Author:NetSeek--------------------------+ EOF #disable ipv6 cat << EOF +--------------------------------------------------------------+ | === Welcome to Disable IPV6 === | +--------------------------------------------------------------+ EOF echo "alias net-pf-10 off" >> /etc/modprobe.conf echo "alias ipv6 off" >> /etc/modprobe.conf /sbin/chkconfig --level 35 ip6tables off echo "ipv6 is disabled!" #disable selinux sed -i '/SELINUX/s/enforcing/disabled/' /etc/selinux/config echo "selinux is disabled,you must reboot!" #vim sed -i "8 s/^/alias vi='vim'/" /root/.bashrc echo 'syntax on' > /root/.vimrc #zh_cn sed -i -e 's/^LANG=.*/LANG="zh_CN.GB18030"/' /etc/sysconfig/i18n #tunoff services #-------------------------------------------------------------------------------- cat << EOF +--------------------------------------------------------------+ | === Welcome to Tunoff services === | +--------------------------------------------------------------+ EOF #--------------------------------------------------------------------------------- for i in `ls /etc/rc3.d/S*` do CURSRV=`echo $i|cut -c 15-` echo $CURSRV case $CURSRV in crond | irqbalance | microcode_ctl | network | random | sendmail | sshd | syslog | local | mysqld ) echo "Base services, Skip!" ;; *) echo "change $CURSRV to off" chkconfig --level 235 $CURSRV off service $CURSRV stop ;; esac done -------------------cut end------------------------------------------- #sh init.sh (执行上面保存的脚本,仍后重启) |
CODE:
-------------------cut begin------------------------------------------- #init_ssh ssh_cf="/etc/ssh/sshd_config" sed -i -e '74 s/^/#/' -i -e '76 s/^/#/' $ssh_cf sed -i "s/#UseDNS yes/UseDNS no/" $ssh_cf #client sed -i -e '44 s/^/#/' -i -e '48 s/^/#/' $ssh_cf echo "ssh is init is ok.............." -------------------cut end--------------------------------------------- |
CODE:
-------------------cut begin------------------------------------------- CHOST="i686-pc-linux-gnu" CFLAGS="-march=prescott -O2 -pipe -fomit-frame-pointer" CXXFLAGS="${CFLAGS}" ./configure \ "--prefix=/usr/local/mysql" \ "--localstatedir=/data/mysql/data" \ "--with-comment=Source" \ "--with-server-suffix=-LinuxTone" \ "--with-mysqld-user=mysql" \ "--without-debug" \ "--with-big-tables" \ "--with-charset=gbk" \ "--with-collation=gbk_chinese_ci" \ "--with-extra-charsets=all" \ "--with-pthread" \ "--enable-static" \ "--enable-thread-safe-client" \ "--with-client-ldflags=-all-static" \ "--with-mysqld-ldflags=-all-static" \ "--enable-assembler" \ "--without-isam" \ "--without-innodb" \ "--without-ndb-debug" make && make install mkdir -p /data/mysql/data useradd mysql -d /data/mysql -s /sbin/nologin /usr/local/mysql/bin/mysql_install_db --user=mysql cd /usr/local/mysql chown -R root:mysql . chown -R mysql /data/mysql/data cp share/mysql/my-huge.cnf /etc/my.cnf cp share/mysql/mysql.server /etc/rc.d/init.d/mysqld chmod 755 /etc/rc.d/init.d/mysqld chkconfig --add mysqld /etc/rc.d/init.d/mysqld start cd /usr/local/mysql/bin for i in *; do ln -s /usr/local/mysql/bin/$i /usr/bin/$i; done -------------------cut end--------------------------------------------- |
CODE:
# ./configure \ "--prefix=/usr/local/apache2" \ "--with-included-apr" \ "--enable-so" \ "--enable-deflate=shared" \ "--enable-expires=shared" \ "--enable-rewrite=shared" \ "--enable-static-support" \ "--disable-userdir" # make # make install # echo '/usr/local/apache2/bin/apachectl start ' >> /etc/rc.local |
CODE:
# ./configure \ "--prefix=/usr/local/php" \ "--with-apxs2=/usr/local/apache2/bin/apxs" \ "--with-config-file-path=/usr/local/php/etc" \ "--with-mysql=/usr/local/mysql" \ "--with-libxml-dir=/usr/local/libxml2" \ "--with-gd=/usr/local/gd2" \ "--with-jpeg-dir" \ "--with-png-dir" \ "--with-bz2" \ "--with-freetype-dir" \ "--with-iconv-dir" \ "--with-zlib-dir " \ "--with-openssl=/usr/local/openssl" \ "--with-mcrypt=/usr/local/libmcrypt" \ "--enable-soap" \ "--enable-gd-native-ttf" \ "--enable-memory-limit" \ "--enable-ftp" \ "--enable-mbstring" \ "--enable-exif" \ "--disable-ipv6" \ "--disable-cgi" \ "--disable-cli" #禁掉ipv6,禁掉cli模式,提升速度和安全性. # make # make install # mkdir /usr/local/php/etc # cp php.ini-dist /usr/local/php/etc/php.ini |
CODE:
#/usr/local/php-fcgi/bin/phpize ./configure --enable-xcache --enable-xcache-coverager --with-php-config=/usr/local/php/bin/php-config \ --enable-inline-optimization --disable-debug |
CODE:
-------------------cut begin------------------------------------------- [xcache-common] zend_extension = /usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/xcache.so [xcache.admin] xcache.admin.user = "admin" ;如何生成md5密码: echo -n "password"| md5sum xcache.admin.pass = "035d849226a8a10be1a5e0fec1f0f3ce" #密码为52netseek [xcache] ; Change xcache.size to tune the size of the opcode cache xcache.size = 24M xcache.shm_scheme = "mmap" xcache.count = 4 xcache.slots = 8K xcache.ttl = 0 xcache.gc_interval = 0 ; Change xcache.var_size to adjust the size of variable cache xcache.var_size = 8M xcache.var_count = 1 xcache.var_slots = 8K xcache.var_ttl = 0 xcache.var_maxttl = 0 xcache.var_gc_interval = 300 xcache.test = Off xcache.readonly_protection = On xcache.mmap_path = "/tmp/xcache" xcache.coredump_directory = "" xcache.cacher = On xcache.stat = On xcache.optimizer = Off [xcache.coverager] xcache.coverager = On xcache.coveragedump_directory = "" -------------------cut end--------------------------------------------- |
CODE:
-------------------cut begin------------------------------------------- #!/bin/bash #Written by :NetSeek #init_httpd.conf http_cf="/usr/local/apache2/conf/httpd.conf" sed -i -e "s/User daemon/User www/" -i -e "s/Group daemon/Group www/" $http_cf sed -i -e '121 s/^/#/' -i -e '122 s/^/#/' $http_cf sed -i 's#DirectoryIndex index.html index.htm# DirectoryIndex index.phpindex.html index.htm#/g' $http_cf sed -i -e '374 s/^#//g' -i -e '389 s/^#//g' -i -e '392 s/^#//g' -i -e '401 s/^#//g' $http_cf #init_php(PHP安全设置及隐藏PHP版本) php_cf="/usr/local/php/etc/php.ini" sed -i '205 s#;open_basedir =#open_basedir = /data/www/wwwroot:/tmp#g' $php_cf sed -i '210 s#disable_functions =#disable_functions = phpinfo,passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_alter,ini_restore,dl,pfsockopen,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server#g' $php_cf sed -i '/expose_php/s/On/Off/' $php_cf sed -i '/display_errors/s/On/Off/' $php_cf -------------------cut end------------------------------------------- |
CODE:
NameVirtualHost *:80 ServerAdmin cnseek@gmail.com DocumentRoot "/data/www/wwwroot/linuxtone.org" ServerName ServerAlias bbs.linxutone.org ErrorLog "logs/dummy-host.example.com-error_log" CustomLog "|/usr/sbin/cronolog /data/logs/access_.%Y%m%d" combined |
CODE:
Timeout 15 KeepAlive Off MaxKeepAliveRequests 50 KeepAliveTimeout 5 UseCanonicalName Off AccessFileName .htaccess ServerTokens Prod ServerSignature Off HostnameLookups Off |
CODE:
ServerLimit 2000 StartServers 10 MinSpareServers 10 MaxSpareServers 15 MaxClients 2000 MaxRequestsPerChild 10000 |
CODE:
# filter the localhost visit SetEnvIf Remote_Addr "127\.0\.0\.1" dontlog # filter some special directories SetEnvIf Request_URI "^ZendPlatform.*$" dontlog SetEnvIf Request_URI \.healthcheck\.html$ dontlog SetEnvIf Remote_Addr "::1" dontlog SetEnvIf Request_URI "\.getPing.php$" dontlog SetEnvIf Request_URI "^/error\.html$" dontlog SetEnvIf Request_URI "\.gif$" dontlog SetEnvIf Request_URI "\.jpg$" dontlog SetEnvIf Request_URI "\.css$" dontlog |
CODE:
RewriteEngine on RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http://(www\.)?mydomain.com/.*$ [NC] RewriteRule \.(gif|jpg)$ http://网站域名/nolink.png [R,L] |