apache+jboss+mod_jk+ssl+php+gd+postgre+sendmail配置
一、 软件列表软件 版本
os Red Hat Linux
jdk jdk-1_5_0_05-linux-i586-rpm.bin
jboss JBoss 4.0.3RC1
openssl openssl-0.9.8d
apr apr-0.9.12
apr-util apr-util-0.9.12
apache apache2.0.54
tomcat-connectors tomcat-connectors-1.2.23-src
freetype freetype-2.3.4
gd gd-2.0.33
jpeg jpegsrc.v6b
libpng libpng-1.2.18
libxml libxml2-2.6.11
zlib zlib-1.2.3
php php5.2.3
sendmail sendmail-8.12.8-4.i386.rpm
sendmail-cf sendmail-cf-8.12.8-4.i386.rpm
sendmail-doc sendmail-doc-8.12.8-4.i386.rpm
postgresql postgresql-8.1.3
二、软件安装
1、安装jdk
# cd /usr/local/carlink
# chmod +x jdk-1_5_0_05-linux-i586-rpm.bin
# ./jdk-1_5_0_05-linux-i586-rpm.bin
# cd /usr/java/
# ln -s /usr/java/jdk1.5.0_05 /usr/local/java
# vi /etc/profile
JAVA_HOME=/usr/local/carlink/java
CLASSPATH=/usr/local/carlink/java/lib/dt.jar:/usr/local/java/lib/tools.jar
PATH=/usr/local/carlink/java/bin:$PATH
export PATH JAVA_HOME CLASSPATH
# source /etc/profile
2、安装jboss
# cd /usr/local/carlink
# tar xvfz jboss-4.0.3RC1.tar.gz
# mv jboss-4.0.3RC1 jboss4
# vi /etc/profile
JAVA_HOME=/usr/local/carlink/java
CLASSPATH=/usr/local/carlink/java/lib/dt.jar:/usr/local/carlink/java/lib/tools.jar
PATH=/usr/local/carlink/java/bin:$PATH
JBOSS_HOME=/usr/local/carlink/jboss4
export PATH JAVA_HOME CLASSPATH JBOSS_HOME
# source /etc/profile
3、安装apr
# tar xvfz apr-0.9.12.tar.gz
# cd apr-0.9.12
# ./configure --prefix=/usr/local/modules/apr
# make && make install
4、安装apr-util
# tar xvfz apr-util-0.9.12.tar.gz
# cd apr-util-0.9.12
# ./configure --prefix=/usr/local/modules/apr-util
--with-apr=/usr/local/modules/apr
# make && make install
5、安装openssl
# tar xvfz openssl-0.9.8d.tar.gz
# cd opensll-0.9.8d
# ./configure --prefix=/usr/local/modules/openssl
# make && make install
6、安装apache
# tar xzvf httpd-2.0.59.tar.gz
# cd httpd-2.0.59
# ./configure --prefix=/usr/local/carlink/apache
--enable-proxy=share --enable-proxy-ajp=share
--enable-rewrite=share --enable-dav=share --enable-so
--enable-ssl=static --with-apr=/usr/local/modules/apr/
--with-apr-util=/usr/local/modules/apa-util/
--with-ssl=/usr/local/modules/openssl/
--enable-mods-shared=all
# make && make install
7、安装zlib
# tar xzvf zlib-1.2.3.tar.gz
# cd zlib-1.2.3
# ./configure --prefix=/usr/local/modules/zlib
# make && make install
8、安装freetype
# tar xzvf freetype-2.3.4.tar.gz
# cd freetype-2.3.4
# ./configure --prefix=/usr/local/modules/freetype
# make && make install
9、安装libpng
# tar xzvf libpng-1.2.18.tar.gz
# cd libpng-1.2.18
# cp scripts/makefile.std makefile
# make install
10、安装jpeg
# mkdir /usr/local/modules/jpeg6
# mkdir /usr/local/modules/jpeg6/bin
# mkdir /usr/local/modules/jpeg6/lib
# mkdir /usr/local/modules/jpeg6/include
# mkdir /usr/local/modules/jpeg6/man
# mkdir /usr/local/modules/jpeg6/man/man1
# tar xzvf jpegsrc.v6b.tar.gz
# cd jpeg6
# ./configure --prefix=/usr/local/modules/jpeg6
--enable-shared --enable-static
# make
# make install
11、安装gd
# tar xzvf gd-2.0.33.tar.gz
# ./configure --prefix=/usr/local/modules/gd
--with-jpeg=/usr/local/modules/jpeg6
--with-png=/usr/local/modules/libpng
--with-zlib=/usr/local/modules/zlib
--with-freetype=/usr/local/modules/freetype
# make
# make install
12、安装libxml
# tar xzvf libxml2-2.6.11.tar.gz
# cd libxml2-2.6.11
# ./configure
# make
# make install
13、安装postgresql
#cd /usr/local/carlink
#tar xvfz postgresql-8.0.3.tar.gz
#cd postgresql-8.0.3
#./configure --prefix=/usr/local/carlink/postgresql && make && make install
#useradd postgres -p postgres -d /usr/local/postgresql
#chown postgres /usr/local/postgresql
#mkdir /usr/local/carlink/postgresql/data
#chown postgres /usr/local/carlink/postgresql/data
#su postgres
#/usr/local/carlink/postgresql/bin/initdb -D /usr/local/carlink/postgresql/data
#vi /usr/local/carlink/postgresql/data/pg_hba.conf
# IPv4 local connections:
host all all 172.19.119.0/12 trust
#vi /usr/local/postgresql/data/postgresql.conf
listen_addresses = '*' # what IP interface(s) to listen on;
# defaults to localhost, '*' = any
14、安装php
# tar xzvf php-5.2.3.tar.gz
# cd php-5.2.3
# ./configure --prefix=/usr/local/carlink/php
--with-apxs2=/usr/local/carlink/apache/bin/apxs
--with-pgsql-dir=/usr/local/carlink/postgresql
--with-xml --with-png=/usr/local/modules/libpng
--with-jpeg-dir=/usr/local/modules/jpeg6
--with-zlib=/usr/local/modules/zlib
--with-freetype=/usr/local/modules/freetype
--with-gd=/usr/local/modules/gd
--enable-track-vars --enable-mbstring=all
# make
# make install
# cp php.ini-dist /usr/local/carlink/php/lib/php.ini
15、安装tomcat-connectors
# tar xzvf tomcat-connectors-1.2.23-src.tar.gz
# cd tomcat-connectors-1.2.23-src
# chmod 755 buildconf.sh
# ./buildconf.sh
# ./configure --with-apxs=/usr/local/apache/bin/apxs
# make
# make install
# cd native/apache-2.0/
# cp mod_jk.so /usr/local/carlink/apache/modules/
三、系统配置
# vi /usr/local/apache/conf/httpd.conf
在文件最末尾加上如下语句
# Load mod_jk
LoadModule jk_module modules/mod_jk.so
# Configure mod_jk
JkWorkersFile conf/workers.properties
JkLogFile logs/mod_jk.log
JkLogLevel info
JkMount /*.jsp loadbalancer
JkMount /servlet/* loadbalancer
JkMount /application/* loadbalancer
# vi /usr/local/carlink/apache/conf/workers.properties
#ln Unix, we use forward slashes:
ps=/
# list the workers by name
worker.list=tomcat1
# ------------------------
# First tomcat server
# ------------------------
worker.tomcat1.port=8009
worker.tomcat1.host=127.0.0.1
worker.tomcat1.type=ajp13
# Specify the size of the open connection cache.
#worker.tomcat1.cachesize
#
# Specifies the load balance factor when used with
# a load balancing worker.
# Note:
# ----> lbfactor must be > 0
# ----> Low lbfactor means less work done by the worker.
worker.tomcat1.lbfactor=100
# ------------------------
# Load Balancer worker
# ------------------------
# The loadbalancer (type lb) worker performs weighted round-robin
# load balancing with sticky sessions.
# Note:
# ----> If a worker dies, the load balancer will check its state
# once in a while. Until then all work is redirected to peer
# worker.
worker.loadbalancer.type=lb
worker.loadbalancer.balanced_workers=tomcat1
# vi $JBOSS_HOME/server/newmsupport/deploy/jbossweb-tomcat/server.xml
<!-- A AJP 1.3 Connector on port 8009 -->
<Connector port="8009" address="${jboss.bind.address}"
emptySessionPath="true" enableLookups="false" redirectPort="8443"
protocol="AJP/1.3"/>
<Engine name="jboss.web" defaultHost="localhost" jvmRoute="tomcat1">
# mkdir /usr/local/carlink/apache/conf/ssl.key
# mkdir /usr/local/carlink/apache/conf/ssl.crt
# openssl req -new -out server.csr
Generating a 1024 bit RSA private key
.........................................++++++
......++++++
writing new private key to 'privkey.pem'
Enter PEM pass phrase:
Verifying - Enter PEM pass phrase:
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) :zh
State or Province Name (full name) :shaanxi
Locality Name (eg, city) :xi'an
Organization Name (eg, company) :softroad
Organizational Unit Name (eg, section) []:softroad
Common Name (eg, your name or your server's hostname) []:jiang
Email Address []:jbakwd@163.com
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
# openssl rsa -in privkey.pem -out server.key
Enter pass phrase for privkey.pem:
writing RSA key
# openssl x509 -in server.csr -out server.crt -req -signkey server.key -days 365
Signature ok
subject=/C=zh/ST=shaanxi/L=xi'an/O=softroad/
OU=softroad/CN=jiang/emailAddress=jbakwd@163.com
Getting Private key
# cp server.crt /usr/local/carlink/apache/conf/ssl.crt/
# cp server.key /usr/local/carlink/apache/conf/ssl.key/
#
vi /usr/local/carlink/apache/conf/ssl.conf
Listen 443
DocumentRoot "/usr/local/carlink/stad"
SSLCertificateFile /usr/local/carlink/apache/conf/ssl.crt/server.crt
SSLCertificateKeyFile /usr/local/carlink/apache/conf/ssl.key/server.key
# /usr/local/carlink/apache/bin/apachectl startssl
# /usr/local/carlink/apache/bin/apachectl stop
页:
[1]