重新编译配置apache,mysql
终于有时间来看看自己的服务器了,
前一段时间一直都是系统发送邮件告诉我mysql数据库连接错误
即使我把最大连接数调整到了3000还是这样的问题。
最近又研究了一下apache的模块,发现服务器上的模块装的太多了,影响浏览的速度
于是按照需要重新规划了一下。
下面是我参考的网址:
sysop.com.cn/system5550,1.html
sysop.com.cn/system23570,1.html
www.5ilinux.com/blog/archives/000013.html
www.go321.cn/html/zsbk/server/18.html
fanqiang.chinaunix.net/app/web/2005-08-30/3548.shtml
www.chedong.com/tech/apache_install.html
www.21php.com/tutorial/tutorial.php?tid=76
www.chinalinuxpub.com/read.php?wid=637
www.phpv.net/article.php/1396
www.linuxmine.com/25.html
先去google搜索了一下mysql的编译时的优化,但是一些都是针对于奔腾处理器的 ![]()
最后配置mysql的参数如下:
- ./configure --prefix=/usr/local/mysql --sysconfdir=/etc --localstatedir=/var/lib/mysql --with-mysqld-ldflags=-all-static --enable-assembler --disable-shared
如果你的处理器是奔腾的,你可以使用pgcc来编译你的mysql
使用下面这样的参数来编译mysql
- CFLAGS="-O6 -mpentiumpro -fomit-frame-pointer" CXX=gcc CXXFLAGS="-O6 -mpentiumpro -fomit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --sysconfdir=/etc --localstatedir=/var/lib/mysql --with-mysqld-ldflags=-all-static --enable-assembler --disable-shared
apache除了常用的模块,其他的也都去掉了
- ./configure --prefix=/usr/local/apache2 --enable-ssl --with-ssl=/usr/local/openssl --enable-deflate --enable-rewrite --enable-vhost-alias --enable-log-config --enable-asis --enable-imap --enable-actions --enable-alias --enable-cgi --disable-access --disable-include --disable-setenvif --disable-autoindex --disable-negotiation --disable-userdir --disable-auth --disable-env
然后就是编译php
- ./configure --prefix=/usr/local/php/ --enable-force-cgi-redirect --enable-mbstring=all --enable-mbregex --enable-mbstr-enc-trans --enable-versioning --enable-trans-sid --enable-ftp --with-mysql=/usr/local/mysql/ --with-apxs2=/usr/local/apache2/bin/apxs --with-openssl=/usr/local/openssl --with-soap=yes --with-curl=/usr/local/curl/ --with-zlib-dir=/usr/local/zlib/ --with-mcrypt=/usr/local/libmcrypt/ --with-gd=/usr/local/gd2 --with-jpeg-dir=/usr --with-freetype-dir=/usr/local/freetype --with-ttf --with-png-dir=/usr --with-mhash=/usr/local/mhash/ --with-dom=/usr/local/libxml2 --with-iconv=/usr/local/libiconv
然后安装Zend和PEAR,就算是搞定了,先运行一段时间看看效果吧~
最近一直在看apache的配置,感觉配置文件确实很重要,我亲自配置的两次apache,因为配置文件不同,差别很大,而且,不需要的模块坚决不要,我个人还是比较喜欢静态编译apache,虽然以后要重新加载新的模块就需要重新编译apache,付出的代价就是缺少灵活性和扩展性,不过一般上线的服务器除非特殊的需要,是不会重新编译apache的。
学习是在工作中进行的,工作是以知识为基础的
