apache重新编译安装
‘壹’ 编译安装apache 需要什么环境
编译Apache的要求如下:
磁盘空间
必须保证有50MB以上的自由临时磁盘空间。Apache安装完毕后会占据10MB左右的空间,实际的磁盘空间需求会因编译设置和是否安装第三方模块而有所不同。
ANSI-C编译器及编译环境
必须装有ANSI-C编译器,推荐使用自由软件基金会(FSF)的GCC。如果没有GCC,那么要确保使用的编译器符合ANSI标准,而且PATH中必须包含指向基本编译工具比如make的路径。
确保准确的时间
由于HTTP协议的元素都会用到时间,有必要了解一下你的系统所使用的时间同步机制。在基于网络时间协议(NTP)的系统中,一般是用ntpdate或xntpd来同步时间。有关NTP软件的资料请参见NTP主页。
Perl 5 [可选]
有些用Perl写的支持脚本,如apxs或dbmmanage ,需要Perl5解释器(5.003或以上的版本就足够了)。如果系统中存在多个Perl解释器,比如有系统提供的Perl 4,还有你自己安装的Perl 5,推荐你使用 --with-perl 选项来确保configure脚本使用正确的版本。如果configure没有没找到Perl 5也没关系,这并不影响Apache httpd的编译和安装,只是相关的支持脚本不能使用而已。
apr/apr-util >= 1.2
apr和apr-util包含在Apache httpd的发行源代码中,并且在绝大多数情况下使用都不会出现问题。当然,如果apr或apr-util的1.0或1.1版本已经安装在你的系统中了,则必须将你的apr/apr-util升级到1.2版本,或者将httpd单独分开编译。要使用发行源代码中自带的apr/apr-util源代码进行安装,你必须手动完成:
# 编译和安装 apr 1.2
cd srclib/apr
./configure --prefix=/usr/local/apr-httpd/
make
make install
# 编译和安装 apr-util 1.2
cd ../apr-util
./configure --prefix=/usr/local/apr-util-httpd/ --with-apr=/usr/local/apr-httpd/
make
make install
# 配置 httpd
cd ../../
./configure --with-apr=/usr/local/apr-httpd/ --with-apr-util=/usr/local/apr-util-httpd/
‘贰’ 为apache添加新的模块支持必需重新编译吗
apache
伪静态
需要在apache中添加伪静态模块,如果是yum安装的apache,是自带伪静态模块的,如果没有,或者是源码编译,可以重新下载apache同版本的源码包,重新编译,
编译方法
可参考下
www.rootop.org/pages/1152.html
然后在ap笭埂蒂忌郦涣垫惟叮隶ache中添加参数载入模块,配置apache支持。添加伪静态规则就行。
如果您认可我的答案,请采纳。
您的采纳,是我答题的动力,O(∩_∩)O谢谢!!
‘叁’ 编译安装apache时出现的问题
我是新手 不懂
‘肆’ centos下编译安装apache
centos下编译安装apache安装apache选择性的安装模块,安装语句如下:./configure
--prefix=/usr/local/apache
--enable-so
--enable-http
--enable-ssl
--enable-rewrite
--enable-expires
--enable-deflate出现错误:configure:
error:
APR
not
found.
Please
read
the
documentation安装apr去http://apr.apache.org/download.cgi下载apr进行安装继续报错:configure:
error:
APR-util
not
found.
Please
read
the
documentation安装APR
去http://apr.apache.org/download.cgi下载apr-util-1.5.1.tar.gz编译安装它搞定收工
‘伍’ 为apache添加新的模块支持必需重新编译吗
不用. 用apxs -a -c -i ****.so 就行了
‘陆’ linux的APACHE服务器的编译安装配置设置从头到尾的步骤.个人主页的建立细节.请高手详细指点.
细节太多了,在这里无法一一列出
妨你看看apache的configure帮助
进入apache的源文件目录后,执行
./configure --help
它会列出所有的东西,很多东西你都可以自定义。其中
--perfix=PATH 是设置安装路径
--bindir=DIR 是设置可执行文件的路径
--libexecdir=DIR 是设置libexec路径
--sysconfdir=DIR 是设置配置文件路径
还有很多,在./configure --help里都有列出来
光盘软件包里面的apache是原来编译好了的,具体的编译方式在安装以后可以可以执行strings /usr/sbin/httpd来查看,里面有很多东西,我们只看我们需要的东西,我这里复制出来你可以看下
-D SUEXEC_BIN="/usr/sbin/suexec"
-D DEFAULT_PIDLOG="/var/logs/httpd.pid"
-D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
-D DEFAULT_LOCKFILE="/var/logs/accept.lock"
-D DEFAULT_ERRORLOG="logs/error_log"
-D AP_TYPES_CONFIG_FILE="conf/mime.types"
-D SERVER_CONFIG_FILE="conf/httpd.conf"
-D HTTPD_ROOT="/etc/httpd"
仅作参考
‘柒’ ubuntu 编译安装apache2怎么重启
步骤
首先,安装Apache2,安装命令:sudo apt-get install apache2
安装完成后,进入到/etc/apache2中(根据自己的实际安装目录),这边我配置文件在/etc/apache2中。
我们看到没有想象中的httpd.conf配置文件,这里要说明的是apache2的配置文件是apache2.conf,而不是http.conf。
打开apache2.conf。写入两条语句
ServerName localhost
DirectoryIndex index.html index.htm index.php
这里的ServerName localhost是为了防止最后开启apache2服务的时候会提示DNS出错。
DirectoryIndex index.html index.htm index.php是默认目录的写法。保存退出。
可以在apache2.conf中加入 AddDefaultCharset GB2312
设置默认字符集,定义服务器返回给客户机默认字符集(由于西欧UTF-8是Apache默认字符集,因此当访问有中文的网页时会出现乱码,这时只要将字符集改成GB2312,再重启Apache服务即可)
Listen 192.168.1.1:80 设置监听ip是192.168.1.1的地址和端口为80
Listen 192.168.1.2:8080 设置监听ip是192.168.1.2的地址和端口为8080
Alias /down "/sofТWare /download"
创建虚拟目录(创建名为down的虚拟目录,它对应的物理路径是:/sofТWare /download)
Alias /ftp "/var/ftp"
创建虚拟目录(创建名为ftp的虚拟目录,它对应的物理路径是:/var/ftp)
<Directory "/var/www/html">
设置目录权限
(<Directory "目录路径">此次写设置目录权限的语句</Directory>)
Options FollowSymLinks page:116
AllowOverride None
</Directory>
需要说明的是,在apache2中,根设置(默认主目录)在 /etc/apache2/sites-АVailable/default中,我们打开default,进行配置。
如图,这里我们的默认主目录设置的路径是/var/www,文档最上方的VirtualHost后方的*代表通配符,即表示所有本机ip地址,监听端口为80,ServerName填写你注册的域名,没有可以不填。保存退出。
4
至此,基本配置已经全部完成,查看本机ip地址。输入启用apache2的命令:/etc/init.d/apache2 restart.并在浏览器中输入本机ip地址。成功!
‘捌’ linux下编译安装apache和常规rpm包安装apache的问题,下面是遇到的情况
编译的时候需要增加参数configure 的时候需要增加参数 --help看看参数的说明,没有指定参数的话有很多模块默认是不安装的
‘玖’ Apache的配置文件语法错误,问题所在怎么修改
解决问题的办法:
1.先看次文:
Full text of PR number 2312:
Received: (qmail 27406 invoked by uid 2012); 28 May 1998 19:08:53 -0000
Message-Id: <19980528190853.27405.qmail@hyperreal.org>
Date: 28 May 1998 19:08:53 -0000
From: Tim Evans <tkevans@eplrx7.es.pont.com>
Reply-To: tkevans@eplrx7.es.pont.com
To: apbugs@hyperreal.org
Subject: syntax error in distributed httpd.conf file
X-Send-Pr-Version: 3.2
>Number: 2312
>Category: os-aix
>Synopsis: syntax error in distributed httpd.conf file
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: apache
>State: closed
>Class: sw-bug
>Submitter-Id: apache
>Arrival-Date: Thu May 28 12:10:00 PDT 1998
>Last-Modified: Thu May 27 12:42:51 PDT 1999
>Originator: tkevans@eplrx7.es.pont.com
>Organization:
>Release: 1.3b7
>Environment:
AIX 4.3; AIX cc
>Description:
After compiling and installing 1.3b7 in default location, I changed *only* the port number in
the distributed httpd.conf file. httpd fails to start with this error:
Syntax error on line 40 of /usr/local/apache/conf/access.conf:
Expected </Directory> but saw </Directory>
NOTE: "Expected </Directory> but saw </Directory>"
>How-To-Repeat:
>Fix:
>Audit-Trail:
State-Changed-From-To: open-analyzed
State-Changed-By: coar
State-Changed-When: Sun Sep 27 09:41:57 PDT 1998
State-Changed-Why:
This is a known problem with the AIX C compiler (see also
PRs 2534, 2664, 2853, and 3042). IBM are aware of the
problem. I'm putting this report into 'analyzed' so we
can notify you of the correction if and when we get one.
Category-Changed-From-To: general-os-aix
Category-Changed-By: coar
Category-Changed-When: Sun Sep 27 09:41:57 PDT 1998
State-Changed-From-To: analyzed-closed
State-Changed-By: shaneo@raleigh.ibm.com
State-Changed-When: Sun Dec 13 14:54:32 PST 1998
State-Changed-Why:
The AIX compiler problem which gave the error of
"on Expected </Files> but saw </Files>" has been fixed.
+ A set of PTF's which correct the problem are available from:
+ http://service.software.ibm.com/support/rs6000
+ The PTF's are: U462005, U462006, U462007, and U462023 through
+ U462030. The PTF's have been tested and do indeed fix the problem.
Thanks for using Apache
From: shaneo@us.ibm.com
To: tkevans@eplrx7.es.pont.com
Cc: apbugs@apache.org
Subject: Re: os-aix/2312: syntax error in distributed httpd.conf file
Date: Wed, 16 Dec 1998 14:00:19 -0500
Yes, the listed PTF's are for the xlC 3.6.4 compiler.
Please talk with your IBM Service Rep. to see
if your compiler is effected.
> Synopsis: syntax error in distributed httpd.conf file
>
> State-Changed-From-To: analyzed-closed
> State-Changed-By: shaneo@raleigh.ibm.com
> State-Changed-When: Sun Dec 13 14:54:32 PST 1998
> State-Changed-Why:
> The AIX compiler problem which gave the error of
> "on Expected </Files> but saw </Files>" has been fixed.
> + A set of PTF's which correct the problem are available from:
> + http://service.software.ibm.com/support/rs6000
> + The PTF's are: U462005, U462006, U462007, and U462023 through
> + U462030. The PTF's have been tested and do indeed fix the problem.
>
These PTF's appear to be for the old AIX compiler, not the latest one
(i.e. "C for AIX Version 4.3").
Comment-Added-By: shaneo@raleigh.ibm.com
Comment-Added-When: Mon Feb 1 07:34:08 PST 1999
Comment-Added:
According to the IBM compiler people:
The AIX 4.3 compiler is old and out of support.
The AIX 3.6.4 C/C++ compiler problem is fixed with the PTF's
listed above
The only forthcoming comiler fix is for the AIX 4.4 C compiler
and this PTF's to fix this will be available in April 99.
Sorry for any confusion that IBM numbering scheme has caused.
Comment-Added-By: shaneo@raleigh.ibm.com
Comment-Added-When: Thu May 27 12:42:49 PDT 1999
Comment-Added:
IBM has released a fix their 4.4 C compiler.
The APAR number is IX87837, you can go to:
http://service.software.ibm.com/cgi-bin/support/rs6000.support/downloads
use the AIX Fix Distribution Service, and search on the APAR number above,
it will pull up the updated filesets with the fix.
Evidently this fix has been available for a while, but I just
got wind of the updated APAR. Shane
>Unformatted:
[In order for any reply to be added to the PR database, ]
[you need to include <apbugs@Apache.Org> in the Cc line ]
[and leave the subject line UNCHANGED. This is not done]
[automatically because of the potential for mail loops. ]
2.针对自己编译器的版本进行修改,我是在最后一种情况,所以我升级了aix的c 编译器,升为4.4.0.3.
3.重新编译安装apache
4.问题解决了。