收藏本站 
广告服务 
网站地图 
>> 本频道近100000余篇各类电脑技术、网络技术、软件技术、网页及平面设计等方面的电脑教程,我们的原则:不是精华拒不收录!
先飞电脑技术网技术文章软件教学Unix/Linux
网络编程 | 网站建设 | 网络技术 | 设计教程 | 软件教学 | 程序开发 | 数据库开发 | 教育认证 | 硬件维护 | 媒体动画 | 机械电子 |
apache 配置完整篇不断添加其功能(一)
[ 作者:佚名    转贴自:本站原创    阅读次数:90    更新时间:2006-1-24 17:39:00   录入:刘光勇 ]         
    

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.gzapache编译时会出现如下错误

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 % !^443$

RewriteRule ^(.*)?$ https://%/ [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你可以确定自己的目录)

文章首页【加入到收藏夹】告诉好友】【打印此文】【关闭窗口
  版权声明:本站提供的“apache 配置完整篇不断添加其功能(一)”版权归文章所有者,转载请注明出处!
 ·上一篇文章:在Redhat中建立交换分区      ·下一篇文章:apache 配置完整篇不断添加其功能(二)
相关文章
·Adaptive Server Anywhere的编程接口[81]
·Adaptive Server Anywhere的特点及用途[100]
·Adaptive Server Anywhere运行时Java类[21]
·连接到Adaptive Server Anywhere数据库[47]
·使用 AsaDataAdapter 对象获取数据[104]
网站主页 | 收藏本页 | 联系我们 | 广告服务 | 站点地图 | 会员注册 | 招聘信息 | 内容指正

联系QQ:先飞电脑技术网站事务联系QQ,点击可以直接留言. 32933427 电话:13710542091 [世界排名] 鄂ICP备05005890号 先飞电脑教程网