RH4apache2+openssl+php+mysql+tomcat2.5配置說明
發表于:2007-05-25來源:作者:點擊數:
標簽:
RedhatAS4(安裝系統時添加了所有的編譯工具) apache2.05+openssl0.97e+php4.0+mysql4.1+tomcat2.5+jdk1.42+jk2 1)安裝opensslhttp://www.openssl.org/source/ #tar-zxvfopenssl-0.9.7e.tar.gz #cdopenssl-0.9.7e #./config #make #makeinstall 我的這一過
Redhat AS 4(安裝系統時添加了所有的編譯工具)
apache2.05+openssl0.97e+php4.0+mysql4.1+tomcat2.5+jdk1.42+jk2
1)安裝 openssl http://www.openssl.org/source/
# tar -zxvf openssl-0.9.7e.tar.gz
# cd openssl-0.9.7e
# ./config
# make
# make install
我的這一過程未出現任何錯誤。
此時生成的openssl 庫是靜態的。Openssl 的安裝路徑是/usr/local/ssl
注:使用openssl-0.9.8.tar.gz時apache編譯時會出現如下錯誤
ssl_engine_pphrase.c:684: error: `PEM_F_DEF_CALLBACK' undeclared (first use in this function)
ssl_engine_pphrase.c:684: error: (Each undeclared identifier is reported only once
ssl_engine_pphrase.c:684: error: for each function it appears in.)
make[3]: *** [ssl_engine_pphrase.lo] Error 1
make[3]: Leaving directory `/soft/httpd-2.0.54/modules/ssl'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/soft/httpd-2.0.54/modules/ssl'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/soft/httpd-2.0.54/modules'
make: *** [all-recursive] Error 1
如果有知道原因的請告知解決辦法,萬分感謝
2)安裝apache(httpd-2.0.54.tar.gz) http://www.apache.org
# tar -zxvf httpd-2.0.54.tar.gz
# ./configure --prefix=/usr/local/httpd --enable-so --enable-ssl=static --enable-mods-shared=all --with-ssl=/usr/local/ssl
make
make install
在apache安裝的根目錄下的/bin下運行 ./apachectl startssl
注:不知道為什么此時用./apachectl start apache能以啟動,但是不能訪問,瀏覽器總是顯示該業無法顯示?。?!
如果有知道原因的請告知解決辦法,萬分感謝?。?!
如果你啟動時出現 httpd: Could not determine the server's fully qualified domain name, using
127.0.0.1 for ServerName
只需要編輯 httpd.conf,找到 ServerName xxxx 這一行,去掉前面的注釋,并把里面改成你的域名或 IP 即可。
3)證書生成
cd /usr/local/ssl/bin
openssl req -new -x509 -days 365 -nodes -out ssl.key -keyout ssl.key
這將會創建一個自己給自己簽名
參數的含義:
-days 365
使這個證書的有效期是 1 年,之
-new
創建一個新的證書
-x509
創建一個 X509 證書(自己簽名
-nodes
這個證書沒有密碼
-out ssl.key
把 SSL 證書公鑰寫到哪里
-keyout ssl.key
把 SSL 私鑰放到這個文件中
# cd /usr/local/httpd/conf/
# mkdir ssl.crt
# mkdir ssl.key
# touch ssl.crt/server.crt
# touch ssl.key/server.key
分別把 ssl.key 中的公鑰、私鑰拷貝到這兩個文件中,server.crt 拷公鑰,server.key 拷私鑰
到此,證書建立完畢。
注意此時生成的只有ssl.key
將
-----BEGIN RSA PRIVATE KEY-----
-----END RSA PRIVATE KEY-----
之間的內容拷貝到server.key
-----BEGIN CERTIFICATE-----
-----END CERTIFICATE-----
之間的內容拷貝到server.crt
修改/usr/local/httpd/conf/ssl.conf
在最后一行加入
RewriteEngine on
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(.*)?$ https://%{SERVER_NAME}/$1 [L,R]
含義我也不太清楚,請高手能否說明一下其中的含義,謝謝
4)安裝mysql 我用的是mysql.4.14.tar.gz http://www.mysql.com
我用的是tar包安裝的
安裝法詳細地可以看INSTALL-BINARY
以下是我的安裝步驟:
groupadd mysql
useradd -g mysql mysql
tar –zxvf mysql.4.14.tar.gz
cd mysql.4.14.tar.gz
./configure --prefix=/usr/local/mysql
make
make install
cp support-files/my-medium.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 &
啟動mysql
/usr/local/mysql/share/mysql/mysql.server start
5)安裝php4.40
tar zxvf php-4.4.0.tar.gz
cd php-4.4.0
./configure --prefix=/usr/local/php --with-config-filepath=/usr/local/php --with-apxs2=/usr/local/httpd/bin/apxs --with-openssl=/usr/local/ssl
--with-mysql=/usr/local/mysql (這是tar包模式)
rpm模式
./configure --prefix=/usr/local/php --with-config-filepath=/usr/local/php --with-apxs2=/usr/local/httpd/bin/apxs --with-openssl=/usr/local/ssl
--with-apxs2=/usr/local/httpd/bin/apxs --with-openssl=/usr/local/ssl
make
make install
更改apache的配制文件:得加幾行,目的是讓apache能解釋php程序。
查找AddType application/x-tar .tgz 行,在下面添加
AddType application/x-httpd-php .php
AddType application/x-httpd-php .php3
AddType application/x-httpd-php .phtml
AddType application/x-httpd-php-source .phps
找到下面一行在后面加上index.php,這表示網站的默認頁也能夠為index.php
DirectoryIndex index.html index.html.var index.php
5)安裝jdk
./j2sdk-1_4_2-
linux-i586.bin
移動jdk1.5.0_03到/usr/local/下
mv jdk1.5.0_03 /usr/local
建立/usr/local/下的jdk連接
# ln -s /usr/local/jdk1.5.0_03 /usr/local/jdk
設置環境變量在/etc/profile文件的最后添加
export JAVA_HOME=/usr/local/jdk
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=$JAVA_HOME/lib
6)安裝tomcat (我的版本是jakarta-tomcat-5.0.30.tar.gz)
tar –zxvf jakarta-tomcat-5.0.30.tar.gz –C /www/ (我的是www你可以確定自己的目錄)
修改環境變量
我的是/etc/profile在最后一行加入(我的時裝在了/www/tomcat目錄)
export CATALINA_HOME=/www/tomcat
你的tomcat所在的目錄.
啟動tomcat
/usr/local/jakarta-tomcat-5.5.9/bin/startup.sh
7)安裝jakarta-tomcat-connectors-jk2-2.0.4-src.tar.gz
tar –zxvf jakarta-tomcat-connectors-jk2-2.0.4-src.tar.gz
cd jakarta-tomcat-connectors-jk2-2.0.4-src
./configure --with-apxs2=/usr/local/httpd2/bin/apxs
make
cd ../build/jk2/apache2/
cp *.so /usr/local/httpd2/modules/
8)配置過程
修改安裝目錄下的/conf/httpd.conf
在LoadModule rewrite_module modules/mod_rewrite.so
LoadModule php4_module modules/libphp4.so
下面添加LoadModule jk2_module modules/mod_jk2.so
在你的安裝目錄下的/conf/創建workers2.properties,內容如下
[logger]
level=ERROR
[config:]
file=/www/conf/workers2.properties (此處改為你安裝目錄下的/conf/下的workers2.properties 我的裝在了/www/conf)
debug=0
debugEnv=0
# Alternate file logger
[logger.file]
#level=DEBUG
level=ERROR
file=/var/log/httpd/jk2.log
[shm:]
info=Scoreboard. Required for reconfiguration and status with multiprocess servers
file=/var/log/httpd/jk2.shm
size=1048576
debug=0
disabled=0
[channel.socket:localhost:8009]
info=Ajp13 forwarding over socket
debug=0
tomcatId=localhost:8009
keepalive=1
[ajp13:localhost:8009]
channel=channel.socket:localhost:8009
debug=0
[status:]
info=Status worker, displays runtime informations
[uri:/jkstatus/*]
info=Display status information and checks the config file for changes.
worker=ajp13:localhost:8009
[uri:/*.jsp]
worker=ajp13:localhost:8009
context=/
修改/www/tomcat/conf/server.xml (你的tomcat 的安裝目錄下的/conf/server.xml
在
<Host name="localhost" debug="0" appBase="apps"
unpackWARs="true" autoDeploy="true">
段中添加:
<Context path="" docBase="/var/www/html" debug="0"
reloadable="true" crossContext="true"/>
保存退出。
附jsp
測試腳本
<html>
<head><title>jsp</title></head>
<body>
<I><%out.println("hello world");%></I>
</body></html>
sword_111 回復于:2005-09-07 08:28:36
|
我以后將在添加tomcat虛擬主機,vsftpd+mysql驗證方式,mail服務器等爭取打造成一個完整的服務器,我也是新手,大多東西都來自網絡,希望大家多多支持:)
|
saxon 回復于:2005-09-07 10:02:30
|
嘿嘿,不錯,頂一下
|
haoyufu 回復于:2005-09-07 10:09:17
|
8錯,兄弟支持
|
hfh08 回復于:2005-09-08 12:29:49
|
謝了 收藏
|
sword_111 回復于:2005-09-09 10:06:21
|
關于虛擬主機與用戶驗證部分http://bbs.chinaunix.net/forum/viewtopic.php?t=608645&show_type=
|
sword_111 回復于:2005-09-09 20:27:51
|
關于整合tomcat的更正
7)安裝jakarta-tomcat-connectors-jk2-2.0.4-src.tar.gz
tar –zxvf jakarta-tomcat-connectors-jk2-2.0.4-src.tar.gz
cd jakarta-tomcat-connectors-jk2-2.0.4-src
./configure --with-apxs2=/usr/local/httpd2/bin/apxs
此配置文件在jakarta-tomcat-connectors-jk2-2.0.4-src/jk/native2
下
|
bjchenxu 回復于:2005-09-12 14:47:33
|
lz真是一個新手呀,不過勇氣可嘉!
回答你的幾個問題吧
1. 關于openssl 0.98的問題,問題是0.98版中將變量名稱改了
解決方案參見
http://www.num5.com/docs/5587.html
3. RewriteEngine on
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(.*)?$ https://%{SERVER_NAME}/$1 [L,R]
含義是這樣的:為了讓用戶訪問傳統的http://轉到https://上來,用了一下rewrite規則:
第一句:啟動rewrite引擎
第二句:rewrite的條件是訪問的服務器端口不是443端口
第三句:這是正則表達式,^是開頭,$是結束,(.*)?是任何數量的任意字符
整句的意思是講:啟動rewrite模塊,將所有訪問非443端口的請求,url地址內容不變,將http://變成https://。
結束
(BTW,ssl模塊編譯成動態模塊也可以)
|
sword_111 回復于:2005-09-13 11:12:57
|
謝謝。樓上的幫助:)
|
原文轉自:http://www.anti-gravitydesign.com
国产97人人超碰caoprom_尤物国产在线一区手机播放_精品国产一区二区三_色天使久久综合给合久久97
|