摘要:開通訪問生成證書編輯,打開以下注釋重啟查看訪問查看端口訪問如果出現恭喜你就成功啦。就不會出上述錯誤了。
版本說明
CentOS版本:
CentOS release 6.8 (Final)
安裝包版本:
httpd-2.4.29.tar.gz
apr-1.6.3.tar.gz
apr-util-1.6.1
pcre-8.41.tar.gz
安裝包一般放在:/usr/local/src
安裝路徑一般為:/usr/local
安裝必要應用
# yum install -y gcc gcc-c++
# yum install -y expat-devel //錯誤1
# yum install -y pcre-devel //錯誤2
# yum install -y openssl-devel //錯誤3
# yum install -y libxml2-devel //錯誤4
apr安裝
# tar zvxf apr-1.6.3.tar.gz
# cd apr-1.6.3
# ./configure --prefix=/usr/local/apr/
# make
# make install
apr-util安裝
# tar zvxf apr-util-1.6.1.tar.gz
# cd apr-util-1.6.1
# ./configure --prefix=/usr/local/apr-util/ --with-apr=/usr/local/apr/
# make
# make install
pcre安裝
# tar zvxf pcre-8.41.tar.gz
# cd pcre-8.41
# ./configure --prefix=/usr/local/pcre/
# make
# make install
apache安裝
# ./configure
--prefix=/usr/local/apache2.4
--sbindir=/usr/local/apache2.4/sbin
--with-apr=/usr/local/apr/
--with-apr-util=/usr/local/apr-util
--with-pcre=/usr/local/pcre/
--enable-ssl
--with-ssl=shared
--enable-proxy=shared
--enable-so
--enable-mods-shared=all
# make
# make install
復制命令到service級別
# cp /usr/local/apache2.4/sbin/httpd /etc/rc.d/init.d
啟動
# service httpd -k start
停止
# service httpd -k stop
重啟
# service httpd -k restart
查看狀態
# service httpd -T
通過80端口狀態查看
# sudo netstat -antp|grep 80
通過進程查看
# ps -ef|grep httpd
訪問查看是否啟動成功
訪問:http://ip:80
出現It works! 恭喜你就成功啦。
生成證書
# cd /usr/local/apache2.4/conf # openssl req -new -x509 -nodes -out server.crt -keyout server.key
編輯httpd.conf,打開以下注釋
Include conf/extra/httpd-ssl.conf LoadModule ssl_module modules/mod_ssl.so LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
重啟apache
查看&訪問
查看443端口:# sudo netstat -antp|grep 443
訪問:https://ip:443 , 如果出現It works! 恭喜你就成功啦。
實現與tomcat整合
編輯httpd.conf,打開以下注釋
LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
通過443端口跳轉
編輯/conf/extra/httpd-ssl.conf(在443虛擬機中加入跳轉的tomcat)
ProxyPass ajp://127.0.0.1:#tomcat的ajp端口#/apache_tomcat_test
重啟apache
訪問: https://ip:443/apache_tomcat_test
通過80端口跳轉(用https,關閉http訪問)
編輯/conf/extra/httpd-ssl.conf(在80虛擬機中加入跳轉的tomcat)
SSLEngine on SSLCertificateFile "/usr/local/apache2/conf/server.crt" SSLCertificateKeyFile "/usr/local/apache2/conf/server.key" ProxyPass ajp://127.0.0.1:#tomcat的ajp端口#/apache_tomcat_test
重啟apache
訪問: https://ip:80/apache_tomcat_test
安裝中的錯誤及解決 錯誤1apr-util-1.6.1編譯時的錯誤
make[1]: Entering directory `/usr/local/apr-util-1.6.1"
/bin/sh /usr/local/apr//build-1/libtool --silent --mode=compile gcc -g -O2 -pthread -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_SOURCE -I/usr/local/apr-util-1.6.1/include -I/usr/local/apr-util-1.6.1/include/private -I/usr/local/apr//include/apr-1 -o xml/apr_xml.lo -c xml/apr_xml.c && touch xml/apr_xml.lo
xml/apr_xml.c:35:19: error: expat.h: No such file or directory
xml/apr_xml.c:66: error: expected specifier-qualifier-list before ‘XML_Parser’
xml/apr_xml.c: In function ‘cleanup_parser’:
xml/apr_xml.c:364: error: ‘apr_xml_parser’ has no member named ‘xp’
xml/apr_xml.c:365: error: ‘apr_xml_parser’ has no member named ‘xp’
xml/apr_xml.c: トップレベル:
xml/apr_xml.c:384: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token
xml/apr_xml.c: In function ‘apr_xml_parser_create’:
xml/apr_xml.c:401: error: ‘apr_xml_parser’ has no member named ‘xp’
xml/apr_xml.c:402: error: ‘apr_xml_parser’ has no member named ‘xp’
xml/apr_xml.c:410: error: ‘apr_xml_parser’ has no member named ‘xp’
xml/apr_xml.c:411: error: ‘apr_xml_parser’ has no member named ‘xp’
xml/apr_xml.c:412: error: ‘apr_xml_parser’ has no member named ‘xp’
xml/apr_xml.c:424: error: ‘apr_xml_parser’ has no member named ‘xp’
xml/apr_xml.c:424: error: ‘default_handler’ undeclared (first use in this function)
xml/apr_xml.c:424: error: (Each undeclared identifier is reported only once
xml/apr_xml.c:424: error: for each function it appears in.)
xml/apr_xml.c: In function ‘do_parse’:
xml/apr_xml.c:434: error: ‘apr_xml_parser’ has no member named ‘xp’
xml/apr_xml.c:438: error: ‘apr_xml_parser’ has no member named ‘xp’
xml/apr_xml.c:442: error: ‘apr_xml_parser’ has no member named ‘xp_err’
xml/apr_xml.c:442: error: ‘apr_xml_parser’ has no member named ‘xp’
xml/apr_xml.c: In function ‘apr_xml_parser_geterror’:
xml/apr_xml.c:500: error: ‘apr_xml_parser’ has no member named ‘xp_err’
xml/apr_xml.c:500: error: ‘apr_xml_parser’ has no member named ‘xp_err’
make[1]: * [xml/apr_xml.lo] Error 1
make[1]: Leaving directory `/usr/local/apr-util-1.6.1"
make: * [all-recursive] Error 1
原因:缺少expat庫,估計是apr-util-1.6不提供了,apr-util-1.5就沒這個錯誤
解決:# yum install -y expat-devel
錯誤2
apache ./configure時的錯誤
checking for pcre-config... false
原因:缺少pcre庫
解決:# yum -y install pcre-devel
錯誤3
apache ./configure時的錯誤
checking for OpenSSL version >= 0.9.8a... FAILED
configure: WARNING: OpenSSL version is too old
原因:OpenSSL版本舊
解決:# yum install -y openssl-devel
錯誤4
apache make時出錯
/usr/local/apr-util//lib/libaprutil-1.so: undefined reference to `XML_ParserCreate"
/usr/local/apr-util//lib/libaprutil-1.so: undefined reference to `XML_GetErrorCode"
/usr/local/apr-util//lib/libaprutil-1.so: undefined reference to `XML_SetUserData"
/usr/local/apr-util//lib/libaprutil-1.so: undefined reference to `XML_ErrorString"
/usr/local/apr-util//lib/libaprutil-1.so: undefined reference to `XML_SetEntityDeclHandler"
/usr/local/apr-util//lib/libaprutil-1.so: undefined reference to `XML_ParserFree"
/usr/local/apr-util//lib/libaprutil-1.so: undefined reference to `XML_SetElementHandler"
/usr/local/apr-util//lib/libaprutil-1.so: undefined reference to `XML_StopParser"
/usr/local/apr-util//lib/libaprutil-1.so: undefined reference to `XML_Parse"
/usr/local/apr-util//lib/libaprutil-1.so: undefined reference to `XML_SetCharacterDataHandler"
collect2: ld returned 1 exit status
make[2]: * [htpasswd] Error 1
make[2]: Leaving directory `/usr/local/httpd-2.4.29/support"
make[1]: * [all-recursive] Error 1
make[1]: Leaving directory `/usr/local/httpd-2.4.29/support"
make: * [all-recursive] Error 1
原因:缺少了xml相關的庫,導致reference無效
解決:# yum install -y libxml2-devel
注意:安裝libxml2-devel后,需要刪掉apr-util,重新安裝
其他說明apache依賴包可以降低到1.5。就不會出上述錯誤了。
apr-1.5.2 apr-util-1.5.2 pcre-8.41
文章版權歸作者所有,未經允許請勿轉載,若此文章存在違規行為,您可以聯系管理員刪除。
轉載請注明本文地址:http://specialneedsforspecialkids.com/yun/35940.html
摘要:本篇的主要目標是通過實際問題來介紹中容易被人忽略的細節以及源碼分析以最新發布的版本的源碼為例并且提供幾種解決方案。探究原因及源碼分析這里以最新發布的版本的源碼作為分析。解決方案加參數基于上面簡要的分析,我們來嘗試下參數的作用。 注:本篇不是入門教程,入門請直接查看官方文檔。本篇的主要目標是通過實際問題來介紹 webpack 中容易被人忽略的細節, 以及源碼分析(以最新發布的 relea...
摘要:作為面試官,我是如何甄別應聘者的包裝程度語言和等其他語言的對比分析和主從復制的原理詳解和持久化的原理是什么面試中經常被問到的持久化與恢復實現故障恢復自動化詳解哨兵技術查漏補缺最易錯過的技術要點大掃盲意外宕機不難解決,但你真的懂數據恢復嗎每秒 作為面試官,我是如何甄別應聘者的包裝程度Go語言和Java、python等其他語言的對比分析 Redis和MySQL Redis:主從復制的原理詳...
摘要:作為面試官,我是如何甄別應聘者的包裝程度語言和等其他語言的對比分析和主從復制的原理詳解和持久化的原理是什么面試中經常被問到的持久化與恢復實現故障恢復自動化詳解哨兵技術查漏補缺最易錯過的技術要點大掃盲意外宕機不難解決,但你真的懂數據恢復嗎每秒 作為面試官,我是如何甄別應聘者的包裝程度Go語言和Java、python等其他語言的對比分析 Redis和MySQL Redis:主從復制的原理詳...
閱讀 2752·2021-11-22 14:45
閱讀 896·2021-10-15 09:41
閱讀 1058·2021-09-27 13:35
閱讀 3662·2021-09-09 11:56
閱讀 2626·2019-08-30 13:03
閱讀 3190·2019-08-29 16:32
閱讀 3296·2019-08-26 13:49
閱讀 765·2019-08-26 10:35