来自:cacti中文论坛(http://cacti.linuxmine.com)
版权信息:欢迎转载,转载请联系cacti中文论坛坛主
前言:
好象在CU发PDF写得多好都加不了精华,原创的提示也不见了,我是个挺虚荣的人,一看什么都没了,那得赶紧写个东西加精华吧,哈哈,最近发现CU讨论apache2.2.0的帖子日益加温,正好几天前给客户做了一套系统,把心得告诉大家,省得大家多走冤枉路。这里主要变化的就是配置tomcat不用连接模块了,关于这个tomcat,我印象最深的是有一次在公司郁闷了,就去中国移动面试,那的技术主管问:您用过tomcat和apache整合吗?我说接触过没研究,只用resin,然后他问我那tomcat开的端口有哪些,都是做什么的呢?我说这个我得查资料,其实主要就是8005、8009、8080这三个端口。呵呵,结果可想而知--我由于不知道tomcat的启动端口而被PASS了。其实想想也挺可笑的,我说的都是实话,技术人员吗,不可能什么都在脑子里,咱们中国人常说:好脑子不如烂笔头。所以我有记录的习惯,什么都习惯写下来,脑子只要记住该记的就行了,呵呵,但是我劝诸位想找个好归宿的还是要有好脑子,最好过目不忘,要不找工作的时候也很危险呦!!更有您觉不觉得找工作看英语过几级,到底有多少人在工作里非要和英语亲密接触呢?我就是,哈哈,但我有dr.eye,呵呵,无奈了...
废话少说,让咱们开始以配置这个曾把我PASS的环境吧 :)
第一章:MAP安装、测试、优化、安全
1、Mysql安装
我的版本选择是mysql-4.0.25.tar.gz,选择这个OLD版本是因为我其他机器的数据库也是这个版本,这样相互导来导去方便点。按我如下傻瓜方式安装吧。
# tar xzvf mysql-4.0.25.tar.gz
# cd mysql-4.0.25
# useradd mysql -s /sbin/nologin
# CFLAGS="-O3 -mpentiumpro" CXX=gcc CXXFLAGS="-O3 -mpentiumpro -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --enable-assembler --with-mysqld-ldflags=-all-static --with--charset=gbk --with-extra-charsets=all;make;make install
睡会儿吧!大概5分钟。--我的1850差不多是这样。为什么用这些参数,请参考
./configure --help
# cp support-files/my-huge.cnf /etc/my.cnf
# cd /usr/local/mysql
# bin/mysql_install_db --user=mysql
# chown -R root .
# chown -R mysql var
# chgrp -R mysql .
# bin/mysqld_safe --user=mysql &
# /usr/local/mysql/bin/mysqladmin -u root password 'hahaha'
# mysql -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 4.0.25-log
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>use mysql
Database changed
mysql> delete from user where Password=';
Query OK, 3 rows affected (0.01 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> exit
Bye
# cp /usr/local/mysql/share/mysql/mysql.server /etc/rc.d/init.d
# chmod 500 /etc/rc.d/init.d/mysql.server
# cd /etc/rc.d/rc3.d
# ln -s ../init.d/mysql.server S99mysql
# ln -s ../init.d/mysql.server K99mysql
Mysql安装完了,那我们开始装apache2.2.0
2、安装apache-2.2.0
到这我们就要说说APR了,这个东西是Apache可移植运行库,源自为了服务器代码的多平台性, 尝试将不同的操作系统特定字节和操作系统无关代码隔离。结果就提供了一个基础API的接口。具体作用大家可参考http://fanqiang.chinaunix.net/app/web/2006-02-21/4012.shtml文章。apache-2.2.0提供了apr连同apr-util的源代码
要使用发行源代码中自带的apr/apr-util源代码进行安装,您必须手动完成:
我们先编译和安装 apr 1.2
# tar xzvf httpd -2.2.0.tar.gz
# cd httpd-2.2.0
# cd srclib/apr
# ./configure --prefix=/usr/local/apr
# make
# make install
现在编译和安装 apr-util 1.2
# cd ../apr-util
# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/
# make
# make install
开始安装配置 apache,在这里我们需要一个mod_proxy_ajp模块,这个是为整合tomcat用的,用2.2.0就是美,哈哈。
cd ../../
# ./configure --prefix=/usr/local/httpd220 --enable-so --enable-rewrite=share --enable-proxy=share --enable-proxy-ajp=share --enable-dav=share --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr-util/
# make
# make install
现在让我们查看编译进apache的模块:
# cd /usr/local/httpd220/bin
# ./httpd -l
我们要的mod_proxy_ajp.c也在其中就能够了。
现在不用配置apache的conf文档,我们直接安装php,我用的是4.4.2版本
# cd /usr/local/httpd220/bin
# cp apachectl /etc/init.d/httpd
# cd /etc/rc3.d
# ln -s ../init.d/httpd S85httpd
# ln -s ../init.d/httpd K85httpd
3、安装php
# tar xzvf php-4.4.2.tar.gz
# cd php-4.4.2
# ./configure --prefix=/usr/local/php442 --with-apxs2=/usr/local/httpd220/bin/apxs --with-config-file-path=/usr/local/php442 --with-mysql=/usr/local/mysql --with-mail --sysconfdir=/usr/local/php442/etc --with-gd --with-zlib --with-png --with-jpeg --with-freetype --enable-sockets
# make;make install
cp php.ini-dist /usr/local/php442/php.ini
4、安装modsecurity(mod_security 能够加强apache的安全性,特别是在防sql 注入上有很好的效果。)
文章整理:西部数码--专业提供域名注册、虚拟主机服务
http://www.west263.com
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!




