leegh 2015-03-23
个人实战经验:redhat6.5+Aapachehttpd2.4.12安装
以下是个人过程记录,还忘指教
redhat机子apache安装日志
准备工作
下载httpd-2.4.12.tar.gzhttpd-2.4.12-deps.tar.gzpcre-8.35.zip
1、Installpcre
$./configure--prefix=/home/bonc/apache2/pcre/pcre--libdir=/home/bonc/apache2/pcre/lib/pcre--includedir=/home/bonc/apache2/pcre/include/pcre
$make&&makeinstall
2、installaprapr-util#说明,如果用户不具有root权限,必须手动安装这两个插件
将压缩文件放在http-2.4.12的srclib目录下解压
$tar-zxvfhttpd-2.4.12.tar.gz
$tar-zxvfhttpd-2.4.12-deps.tar.gz
$cdhttpd-2.4.12/srclib/apr
$./configure--prefix=/home/bonc/apache2/apr
$make&&makeinstall
$cdhttpd-2.4.12/srclib/apr-util
$./configure--prefix=/home/bonc/apache2/apr-util--with-apr=/home/bonc/apache2/apr
$make&&makeinstall
3、installapache2
$cdhttpd-2.4.12
$./configure--prefix=/home/bonc/apache2/apache--enable-so--with-apr=/home/bonc/apache2/apr--with-apr-util=/home/bonc/apache2/apr-util/bin--with-pcre=/home/bonc/apache2/pcre/pcre--enable-mods-shared=all--with-mpm=worker--enable-cache--enable-disk-cache--enable-mem-cache--enable-file-cache
$make&&makeinstall
4、configureapache2
$vi/home/bonc/apache2/apache/conf/httpd.conf
Listen8301#这里需要注意,如果没有root权限,普通用户是不具有80端口的访问权限的,因此需要修改为其他端口,普通用户才能启动自己安装的apache
LoadModuleproxy_http_modulemodules/mod_proxy_http.so
LoadModuleproxy_connect_modulemodules/mod_proxy_connect.so
LoadModuleproxy_modulemodules/mod_proxy.so
LoadModuleproxy_modulemodules/mod_proxy_blancer.so
LoadModulelbmethod_byrequests_modulemodules/mod_lbmethod_byrequests.so
LoadModuleslotmem_shm_modulemodules/mod_slotmem_shm.so
#ServerNamewww.example.com:80
ServerNamelocalhost:8090
#addproxy.confphp.conf
Includeconf/extra/proxy.conf
$vi/home/bonc/apache2/apache/conf/extra/proxy.conf
ProxyRequestsOff
ProxyPreserveHostOn
ProxyPass/vbapbalancer://vbapstickysession=JSESSIONIDnofailover=Off
ProxyPassReverse/vbapbalancer://vbap
<Proxybalancer://vbap>
BalancerMemberhttp://127.0.0.1:8080/vbaploadfactor=1route=jvm8080
BalancerMemberhttp://127.0.0.1:8081/vbaploadfactor=1route=jvm8081
</Proxy>
5、tomcat配置
$vitomcat_x/conf/server.conf
#配置关闭端口
<Serverport="8006"shutdown="SHUTDOWN">
#配置访问端口
<Connectorport="8081"protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443"/>
#配置AJP端口
<Connectorport="8010"protocol="AJP/1.3"redirectPort="8443"/>
#配置jvm
<Enginename="Catalina"defaultHost="localhost"jvmRoute="jvm8080">
6、Startrestartstophttpdservice
$cd/home/wmj/soft/apache2/bin
#启动apache
$./apachectlstart
#重启apache
$./apachectlrestart
#停止apache
$./apachectlstop
遇到以下错误
[bonc@bonc-qh1bin]$apachectlstart
httpd:apr_sockaddr_info_get()failedforbonc-qh1
httpd:Couldnotreliablydeterminetheserver'sfullyqualifieddomainname,using127.0.0.1forServerName
(13)Permissiondenied:Errorretrievingpidfilerun/httpd.pid
Removeitbeforecontinuingifitiscorrupted.
一般是因为ServerNamelocalhost:8090的配置
另外一个原因是系统默认安装了httpd我是卸载默认安装的服务后正常的