apache安装后,如果想再添加模块,往往不想重新安装一次,再者,我在安装中发现,并不是安装文件中所有的modules都会被默认安装,即使在安装中使用了 ./configure --prefix=/usr/local/apache --enable-so --enable-modules=all --enable-mods-shared=all也是如此。我使用上述方法安装的apache2.2.6就没有安装proxy相关模块。这时,需要手工生成so文件,但会自动的被复制到你的apache安装目录的modules中,然后修改apache的配置文件,加载相关模块,验证apache配置并重启服务即可。以上描述的具体操作步骤如下:
操作系统:linux redhat 4.5 ES
apache版本:2.2.6 可自行下载tar包
1. 拷贝安装包到/usr/local,并在目标目录下进行解压。[root@localhost local]# cd /usr/local[root@localhost local]# tar -zxvf httpd-2.2.4.tar.gz2. 配置安装参数,安装的目标目录为/usr/local/apache,建议设置enable-mods-shared=all,不用的module注释掉就行了![root@localhost local]# cd httpd-2.2.4[root@localhost httpd-2.2.4]# ./configure --prefix=/usr/local/apache --enable-so --enable-mods-shared=all3. 编译并安装。[root@localhost httpd-2.2.4]# make[root@localhost httpd-2.2.4]# make install4. 启动Apache,并测试。[root@localhost httpd-2.2.4]# cd /usr/local/apache/bin[root@localhost bin]# ./apachectl start
打开浏览器,并在地址栏中输入主机的IP地址如http://192.168.1.254/如果出现以下画面则说明安装成功。It works! 注意:安装完成后检查系统服务中的HTTPD服务是否已经启动,如果启动需要先停止。
5. 编译mod_proxy.so.
[root@localhost httpd-2.2.4]# cd modules
[root@localhost modules]# /usr/local/apache/bin/apxs -c -i mod_proxy.c proxy_util.c
这时生成的mod_proxy.so会被自动复制到/usr/local/apache/modules
6. 修改配置文件
[root@localhost modules]# cd /usr/local/apache/conf
[root@localhost conf]# vi httpd.conf
添加一行 LoadModule proxy_module modules/mod_proxy.so
7. 测试配置是否正确
[root@localhost conf]# cd ..[root@localhost apache]# cd bin[root@localhost bin]# ./apachectl configtest
出现如下信息证明配置正确
[Fri Nov 23 15:45:55 2007] [warn] module rewrite_module is already loaded, skippingSyntax OK8. 重新启动apache
[root@localhost bin]# ./apachectl stop
[root@localhost bin]# ./apachectl start
完成!!
-------------------------------
Personal Configuration:
安装apache============>> apr
#tar -zxvf apr-1.3.2.tar.gz#cd apr-1.3.2#./configure --prefix=/usr/local/apr-httpd/#make#make install
>>apr-util
#tar -zxvf apr-util-1.3.2.tar.gz#cd apr-util-1.3.2#./configure --prefix=/usr/local/apr-util-httpd/ --with-apr=/usr/local/apr-httpd/#make#make install
>> apache
#tar -zxvf httpd-2.2.9.tar.gz#cd httpd-2.2.9#./configure --prefix=/usr/local/apache22 \--with-apr=/usr/local/apr-httpd \--with-apr-util=/usr/local/apr-util-httpd \--with-mpm=prefork \--enable-so \--enable-rewrite \--enable-info \--enable-mime-magic \--enable-vhost-alias \--enable-deflate \--enabel-expires \#make#make install
安装php5=========>>mhash
#tar -zxvf mhash-0.9.6.tar.gz#cd mhash-0.9.6#./configure --prefix=/usr/local/mhash#make#make install#cd include/mutils/#rm -R CVS#cp * /usr/local/mhash/include/mutils/
>> xml2#pkg_add -r libxml2
>> PNG#pkg_add -r png
>>iconv#pkg_add -r libiconv
>> php5#tar -zxvf php-5.2.6.tar.gz#cd php-5.2.6#./configure --prefix=/usr/local/php \--with-apxs2=/usr/local/apache22/apxs \--with-mysql=/usr/local/mysql \--with-curl \--disable-debug\--enable-inline-optimization -q \--enable-zlib \--enable-gd \--enable-iconv \--enable-mbstring \#make#make install
配置=====2.apache[/apache/conf/httpd.conf ]修改
A. ServerAdmin your@doman.comB. ServerName 127.0.0.1:80
C. Options FollowSymLinks AllowOverride None Order deny,allow Allow from all # <-- 原来为Deny
D. DirectoryIndex index.html index.php # <-- 增加index.php
E. AddType application/x-compress .Z AddType application/x-gzip .gz .tgz AddType application/x-httpd-php .php # <-- 增加
F. 启用MPM、Virtual hosts# Server-pool management (MPM specific)Include conf/extra/httpd-mpm.conf
# Virtual hostsInclude conf/extra/httpd-vhosts.conf
E.修改MPM、Virtual Hosts StartServers 5 MinSpareServers 5 MaxSpareServers 10 ServerLimit 4000 MaxClients 2000 MaxRequestsPerChild 0
ServerAdmin webmaster@test.com DocumentRoot /Data/webapps ServerName www.test.com ErrorLog logs/test.com-error_log CustomLog logs/test.com-access_log common
测试: =========在/apache2/htdocs 创建文件phpinfo.php 内容为:
操作系统:linux redhat 4.5 ES
apache版本:2.2.6 可自行下载tar包
1. 拷贝安装包到/usr/local,并在目标目录下进行解压。[root@localhost local]# cd /usr/local[root@localhost local]# tar -zxvf httpd-2.2.4.tar.gz2. 配置安装参数,安装的目标目录为/usr/local/apache,建议设置enable-mods-shared=all,不用的module注释掉就行了![root@localhost local]# cd httpd-2.2.4[root@localhost httpd-2.2.4]# ./configure --prefix=/usr/local/apache --enable-so --enable-mods-shared=all3. 编译并安装。[root@localhost httpd-2.2.4]# make[root@localhost httpd-2.2.4]# make install4. 启动Apache,并测试。[root@localhost httpd-2.2.4]# cd /usr/local/apache/bin[root@localhost bin]# ./apachectl start
打开浏览器,并在地址栏中输入主机的IP地址如http://192.168.1.254/如果出现以下画面则说明安装成功。It works! 注意:安装完成后检查系统服务中的HTTPD服务是否已经启动,如果启动需要先停止。
5. 编译mod_proxy.so.
[root@localhost httpd-2.2.4]# cd modules
[root@localhost modules]# /usr/local/apache/bin/apxs -c -i mod_proxy.c proxy_util.c
这时生成的mod_proxy.so会被自动复制到/usr/local/apache/modules
6. 修改配置文件
[root@localhost modules]# cd /usr/local/apache/conf
[root@localhost conf]# vi httpd.conf
添加一行 LoadModule proxy_module modules/mod_proxy.so
7. 测试配置是否正确
[root@localhost conf]# cd ..[root@localhost apache]# cd bin[root@localhost bin]# ./apachectl configtest
出现如下信息证明配置正确
[Fri Nov 23 15:45:55 2007] [warn] module rewrite_module is already loaded, skippingSyntax OK8. 重新启动apache
[root@localhost bin]# ./apachectl stop
[root@localhost bin]# ./apachectl start
完成!!
-------------------------------
Personal Configuration:
安装apache============>> apr
#tar -zxvf apr-1.3.2.tar.gz#cd apr-1.3.2#./configure --prefix=/usr/local/apr-httpd/#make#make install
>>apr-util
#tar -zxvf apr-util-1.3.2.tar.gz#cd apr-util-1.3.2#./configure --prefix=/usr/local/apr-util-httpd/ --with-apr=/usr/local/apr-httpd/#make#make install
>> apache
#tar -zxvf httpd-2.2.9.tar.gz#cd httpd-2.2.9#./configure --prefix=/usr/local/apache22 \--with-apr=/usr/local/apr-httpd \--with-apr-util=/usr/local/apr-util-httpd \--with-mpm=prefork \--enable-so \--enable-rewrite \--enable-info \--enable-mime-magic \--enable-vhost-alias \--enable-deflate \--enabel-expires \#make#make install
安装php5=========>>mhash
#tar -zxvf mhash-0.9.6.tar.gz#cd mhash-0.9.6#./configure --prefix=/usr/local/mhash#make#make install#cd include/mutils/#rm -R CVS#cp * /usr/local/mhash/include/mutils/
>> xml2#pkg_add -r libxml2
>> PNG#pkg_add -r png
>>iconv#pkg_add -r libiconv
>> php5#tar -zxvf php-5.2.6.tar.gz#cd php-5.2.6#./configure --prefix=/usr/local/php \--with-apxs2=/usr/local/apache22/apxs \--with-mysql=/usr/local/mysql \--with-curl \--disable-debug\--enable-inline-optimization -q \--enable-zlib \--enable-gd \--enable-iconv \--enable-mbstring \#make#make install
配置=====2.apache[/apache/conf/httpd.conf ]修改
A. ServerAdmin your@doman.comB. ServerName 127.0.0.1:80
C.
D.
E. AddType application/x-compress .Z AddType application/x-gzip .gz .tgz AddType application/x-httpd-php .php # <-- 增加
F. 启用MPM、Virtual hosts# Server-pool management (MPM specific)Include conf/extra/httpd-mpm.conf
# Virtual hostsInclude conf/extra/httpd-vhosts.conf
E.修改MPM、Virtual Hosts
测试: =========在/apache2/htdocs 创建文件phpinfo.php 内容为:
评论