mod_ssl报错,装了最新的apache

今天回来发现apache不能启动了,郁闷,报的错误是mod_ssl无法加载,我把#LoadModule ssl_module modules/mod_ssl.so加截ssl的地方注释掉就好了。以前都配置好了的,今天怎么会不行了呢?我又重新把mod_ssl编译了一下,

cd /apache的解压目录/modules/ssl

[root@BlackGhost ssl]# /usr/local/apache/bin/apxs -c -i mod_ssl.c

ssl_private.h:541:14: error: declaration for parameter 'ssl_hook_UserCheck' but no such parameter
ssl_private.h:540:14: error: declaration for parameter 'ssl_hook_Auth' but no such parameter
ssl_private.h:537:14: error: declaration for parameter 'ssl_init_ModuleKill' but no such parameter
ssl_private.h:536:14: error: declaration for parameter 'ssl_init_Child' but no such parameter
mod_ssl.c:520:1: error: expected '{' at end of input
apxs:Error: Command Failed with rc=65536

上面的报错只是最下面的一部分,搞了好长时间,没搞定,决定下个新的apache重装一下,顺便把安装过程说一下

一,安装httpd-2.2.16.tar.gz

wget  http://www.apache.org/dist/httpd/httpd-2.2.16.tar.gz

tar zxvf httpd-2.2.16.tar.gz

cd httpd-2.2.16

./configure --prefix=/usr/local/apache --enable-ssl   --enable-so   --with-ssl=/us

make && make install

1,改documentroot和默认路径改成你的web目录。

2,加载libPHP.so

我记得以前装PHP的时候,会自动添加好下面的东西,但是这次我只升级apache,我还没找到libPHP.c文件在什么地方,没法用apxs来重新编译,还是用以前的libPHP5.so

LoadModule PHP5_module        modules/libPHP5.so
AddType application/x-httpd-PHP .PHP .phtml
AddType application/x-httpd-PHP-source .PHPs
AddType application/x-httpd-PHP .PHP

如果不加上面的东西,PHP代码无法解悉,会直接把源码显示出来

3,修改user和group,你看一下user后面的用户,在你的系统中有没有,如果没有的话,你启动apache后,查看页面时会forbidden错误,改成你指定的用户,当然这个用户必有在你的系统中。

# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd,as with most system services.
#
User zhangy
Group users

二,编译mod_ssl模块看看报不报错

cd /apache的解压目录/modules/ssl

/usr/local/apache/bin/apxs -c -i mod_ssl.c

make && make install

下面是安装时候显示出来的信息

Libraries have been installed in:
/usr/local/apache/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/apache/modules/mod_ssl.so

现在编译就没有报错了,我觉得肯定是因为我升级的原因,并且只是升级了一部分。安装的时候,我已经内建了mod_ssl所以就不用在加载了。如果加了的话,会提示module ssl_module is built-in and can't be loaded

[root@BlackGhost misc]# /usr/local/apache/bin/apachectl configtest
Syntax OK

相关文章

###进入nginx 目录cd /usr/local/nginx###递归显示 2 级目录...
在cmd命令窗口输入下面命令进行查看 tasklist /fi "ima...
Nginx显示500错误原因和解决方法
linux系统下启停nginx的命令
nginx 的 default_server 指令可以定义默认的 server出处理一...
Nginx是一款轻量级的 Web 服务器、反向代理服务器,由于它的...