linux下不重新编译apache添加安装mod_ssl模块和错误的处理方法

安装步骤

1、进入apache源码目录。

2、进入module文件夹下的ssl目录。

3、找到oepnssl 的include路径,ubuntu系统是在/usr/include/openssl目录。

4、运行apxs

root@v238:~/httpd-2.2.26/modules/ssl# /usr/local/apache2/bin/apxs -i -c -a -D HAVE_OPENSSL=1 -I /usr/include/openssl -lcrypto -lssl -ldl *.c
/usr/local/apr-httpd//build-1/libtool --silent --mode=compile gcc -prefer-pic -DLINUX -D_REENTRANT -D_GNU_SOURCE -g -O2 -pthread -I/usr/local/apache2/include -I/usr/local/apr-httpd//include/apr-1 -I/usr/local/apr-util-httpd/include/apr-1 -I/usr/include/openssl -DHAVE_OPENSSL=1 -c -o mod_ssl.lo mod_ssl.c && touch mod_ssl.slo
/usr/local/apr-httpd//build-1/libtool --silent --mode=compile gcc -prefer-pic -DLINUX -D_REENTRANT -D_GNU_SOURCE -g -O2 -pthread -I/usr/local/apache2/include -I/usr/local/apr-httpd//include/apr-1 -I/usr/local/apr-util-httpd/include/apr-1 -I/usr/include/openssl -DHAVE_OPENSSL=1 -c -o ssl_engine_config.lo ssl_engine_config.c && touch ssl_engine_config.slo
......
/usr/local/apache2/build/instdso.sh SH_LIBTOOL='/usr/local/apr-httpd//build-1/libtool' mod_ssl.la /usr/local/apache2/modules
/usr/local/apr-httpd//build-1/libtool --mode=install cp mod_ssl.la /usr/local/apache2/modules/
libtool: install: cp .libs/mod_ssl.so /usr/local/apache2/modules/mod_ssl.so
libtool: install: cp .libs/mod_ssl.lai /usr/local/apache2/modules/mod_ssl.la
libtool: install: cp .libs/mod_ssl.a /usr/local/apache2/modules/mod_ssl.a
libtool: install: chmod 644 /usr/local/apache2/modules/mod_ssl.a
libtool: install: ranlib /usr/local/apache2/modules/mod_ssl.a
libtool: finish: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/jvm/jdk1.7.0_45/bin:/sbin" ldconfig -n /usr/local/apache2/modules
----------------------------------------------------------------------
Libraries have been installed in:
 /usr/local/apache2/modules
if you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
 - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
 during execution
 - add LIBDIR to the `LD_RUN_PATH' environment variable
 during linking
 - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
 - have your system administrator add LIBDIR to `/etc/ld.so.conf'
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
chmod 755 /usr/local/apache2/modules/mod_ssl.so
[activating module `ssl' in /usr/local/apache2/conf/httpd.conf]
5、检查配置、重启

执行成功后可以在httpd.conf配置文件中看到已经添加了mod_ssl模块,apache安装目录下的module中也创建了mod_ssl.so 文件。

root@v238:~/httpd-2.2.26/modules/ssl# /usr/local/apache2/bin/httpd -t
httpd: Could not reliably determine the server's fully qualified domain name, using 192.168.0.238 for ServerName
Syntax OK
提示syntax ok,重启apache。

错误处理

错误一、

错误代码,error "Unrecognized SSL Toolkit!、declaration for parameter 'XXXXXX' but no such parameter 。

出现这个错误是由于 HAVE_OPENSSL这个没有define ,可以通过添加-D HAVE_OPENSSL=1 解决。

root@v238:~/httpd-2.2.26/modules/ssl# /usr/local/apache2/bin/apxs -i -c -a mod_ssl.c
/usr/local/apr-httpd//build-1/libtool --silent --mode=compile gcc -prefer-pic -DLINUX -D_REENTRANT -D_GNU_SOURCE -g -O2 -pthread -I/usr/local/apache2/include -I/usr/local/apr-httpd//include/apr-1 -I/usr/local/apr-util-httpd/include/apr-1 -c -o mod_ssl.lo mod_ssl.c && touch mod_ssl.slo
In file included from ssl_private.h:60:0,
from mod_ssl.c:27:
ssl_toolkit_compat.h:267:2: error: #error "Unrecognized SSL Toolkit!"
In file included from ssl_private.h:72:0,
from mod_ssl.c:27:
ssl_util_ssl.h:78:31: error: unknown type name 'SSL'
ssl_util_ssl.h:79:31: error: unknown type name 'SSL'
ssl_util_ssl.h:80:1: error: unknown type name 'X509'
...
ssl_private.h:637:14: error: declaration for parameter 'ssl_hook_Upgrade' but no such parameter
ssl_private.h:636:14: error: declaration for parameter 'ssl_hook_ReadReq' but no such parameter
ssl_private.h:635:14: error: declaration for parameter 'ssl_hook_Fixup' but no such parameter
ssl_private.h:634:14: error: declaration for parameter 'ssl_hook_Access' but no such parameter
ssl_private.h:633:14: error: declaration for parameter 'ssl_hook_UserCheck' but no such parameter
ssl_private.h:632:14: error: declaration for parameter 'ssl_hook_Auth' but no such parameter
ssl_private.h:629:14: error: declaration for parameter 'ssl_init_ModuleKill' but no such parameter
ssl_private.h:628:14: error: declaration for parameter 'ssl_init_Child' but no such parameter
mod_ssl.c:573:1: error: expected '{' at end of input
apxs:Error: Command failed with rc=65536
#解决
root@v238:~/httpd-2.2.26/modules/ssl# /usr/local/apache2/bin/apxs -i -c -a -D HAVE_OPENSSL=1 -I /usr/include/openssl mod_ssl.c
错误二、

错误代码,undefined symbol: ssl_cmd_SSLMutex 。

apxs编译追加模块成功,但是apache启动失败。出现这个错误后,我把运行apxs时指定mod_ssl.c改成*.c 。和添加mod_deflate不一样,ssl中包含多个源代码文件。

root@v238:~/httpd-2.2.26/modules/ssl# /usr/local/apache2/bin/httpd -t
httpd: Syntax error on line 107 of /usr/local/apache2/conf/httpd.conf: Cannot load /usr/local/apache2/modules/mod_ssl.so into server: /usr/local/apache2/modules/mod_ssl.so: undefined symbol: ssl_cmd_SSLMutex
root@v238:~/httpd-2.2.26/modules/ssl#
#解决
root@v238:~/httpd-2.2.26/modules/ssl# /usr/local/apache2/bin/apxs -i -c -a -D HAVE_OPENSSL=1 -I /usr/include/openssl *.c
错误三、

错误代码,undefined symbol: X509_INFO_free ,这个通常是由于静态连接了 openssl的库造成的(默认),解决办法是添加-lcrypto -lssl -ldl参数。

root@v238:~/httpd-2.2.26/modules/ssl# /usr/local/apache2/bin/httpd -t
httpd: Syntax error on line 107 of /usr/local/apache2/conf/httpd.conf: Cannot load /usr/local/apache2/modules/mod_ssl.so into server: /usr/local/apache2/modules/mod_ssl.so: undefined symbol: X509_INFO_free
#解决
root@v238:~/httpd-2.2.26/modules/ssl# /usr/local/apache2/bin/apxs -i -c -a -D HAVE_OPENSSL=1 -I /usr/include/openssl -lcrypto -lssl -ldl  *.c
 

到这里在已安装的apache中追加mod_ssl模块就完成了,不过还是建议在第一次编译apache的时候就添加ssl模块 。

时间: 2024-08-31 11:17:57

linux下不重新编译apache添加安装mod_ssl模块和错误的处理方法的相关文章

linux下mysql提示"mysql deamon failed to start"错误的解决方法_Mysql

有台linux服务器,系统为centos系统. 网站突然连接不上数据库,于是朋友直接重启了一下服务器.进到cli模式下,执行 service myqsld start 发现还是提示"mysql deamon failed to start"错误信息. # /etc/init.d/mysqld start MySQL Daemon failed to start. Starting mysqld: [FAILED] 查看mysqld的log文件 #less /var/log/mysqld

Linux下源码编译安装配置SVN服务器的步骤分享_Linux

说明: SVN(subversion)的运行方式有两种: 一种是基于Apache的http.https网页访问形式: 还有一种是基于svnserve的独立服务器模式. SVN的数据存储方式也有两种:一种是在Berkeley DB数据库中存储数据:另一种是使用普通的文件FSFS存储数据. 由于Berkeley DB方式在使用中有可能锁住数据,一般建议使用FSFS方式更安全. 实现目的: 以svnserve的独立服务器模式,使用FSFS数据存储方式源码编译安装配置SVN服务器. 具体操作: 操作系统

linux 编译-linux下怎么将一个开源包添加到自己的工程里

问题描述 linux下怎么将一个开源包添加到自己的工程里 下载下来的开源程序包,怎么编译到自己现有的工程里面,要能编译通过,,, 解决方案 仔细阅读开源包里的说明文档 解决方案二: 一般都提供了makefile,可以编译源码,生成类库等 然后包含头文件,链接类库

linux下用cronolog分割apache日志

linux下用cronolog分割apache日志,大神莫拍砖,菜鸟留一记录,小白请默默转载.连linux登陆和vi编辑都不会的,请默默关闭此页面.入正题 说明:淡绿色底的为linux命令,其他的为备注说明. 下载cronolog wget "http://download.chinaunix.net/down.php?id=3457&ResourceID=1851&site=1"#解压缩tar -xzvf cronolog-1.6.2.tar.gz#进入目录cd cr

linux下查看nginx、apache、mysql、php的编译参数

下文我们一起来看一个linux下查看nginx.apache.mysql.php的编译参数例子,希望此例子对各位有帮助. 查看nginx.apache.mysql.php参数我们可以用到 /App/nginx/sbin/nginx -V 查看nginx参数 # cat config.nice 查看apache参数 #cat "/usr/local/mysql/bin/mysqlbug"|grep configure 查看mysql参数 /usr/local/php/bin/php -i

c语言-Linux下使用gcc编译c11程序是不是过于麻烦了?

问题描述 Linux下使用gcc编译c11程序是不是过于麻烦了? 每次都要输入-std=c11 是不是过于麻烦了?怎么让它默认为-std=c11? 解决方案 因为它默认是c89等标准,所以需要指定 你可以写一个makefile ,这样每次只用make来编译

我用.net 开发的框架、网站在 linux下全部移植编译调试测试完毕,非常爽!

问题描述 我用.net开发的框架.网站在linux下全部移植编译调试测试完毕,非常爽!我快爽晕了,哈哈!特提供一个典型的测试网站供大家观摩http://wwww.bwsyq.com看清楚是4个w啊不能访问可以通过下面的地址进行访问由于是测试,所以用的是ADSL,IP地址经常变化,域名不能用可参考下面提供的最新的IP地址!用的是我的笔记本,带宽只有2MB!部署环境ubuntu10.10+mysql5.1+apache2+mono2.67开发环境ubuntu10.10+mono2.67+mono-d

Linux下 php5 MySQL5 Apache2 phpMyAdmin ZendOptimizer安装与配置[图文]_php基础

需要大家细心和耐心.这些在安装过程中大家将会体会到.不正确的地方大家指正批评.本例是在red hat 9下 php5.2.1 apache2.2.4 MySQL5.0.37 phpmyadmin2.10.0.2 ZendOptimizer-3.2.6 libxml2-2.6.11 的安装与配置 其中 libxml2-2.6.11 我下载在 /usr/ 目录下 其他都下载在 /usr/down 目录下.这些目录在下面安装过程中要用到 关于windows下的php环境配置可以参考 http://ww

Linux下jsp环境:apache,tomcat配置

apache|js Linux下jsp开发环境,apache,tomcat服务器配置过程: (特别注明:本文内容均参考于互联网,经过个人实践而总结,若配置中遇到问题请联系我,可能写的时候漏掉了某些地方,感谢网上前辈的经验,希望更多的实践经验得以共享) 1.操作系统 RedHat Linux 9.0 2.所需软件 Apache 2.0.54 下载地址 http://apache.freelamp.com/httpd 下载该文件httpd-2.0.54.tar.gz Tomcat5.5.9 下载地址