Apache源碼包在LINUX(CENTOS6.8)中的安裝(出現問題及解決)

来源:https://www.cnblogs.com/dreamyoung/archive/2019/08/23/11396094.html
-Advertisement-
Play Games

linux centos apache httpd apr apr-util pcre rpm 源碼包 ...


任務在CENT6.8系統中安裝Apache(版本為:httpd-2.4.41)

前提由於源碼包必須先編譯後安裝,所以必須先安裝編譯器:gcc

理論步驟

1.檢測gcc軟體包,如果不存在則進行安裝。

2.下載Aache的源碼包(壓縮包形式)並上傳到CENTOS伺服器中

3.解壓源碼包後進入解壓後的目錄,執行配置,編譯,安裝。

  3.1 配置:使用 ./configure 進行安裝目錄的設置

       3.2 編譯:使用 make 命令直接執行

       3.3 安裝:使用 make install 命令直接執行。

4.如果無意外,按照“理論步驟',完成後即可在CENTOS伺服器啟用httpd服務(運行apache)中,使用瀏覽器訪問

     http://localhost/       或   http://127.0.0.1       或    http://192.168.253.129    

 

實際過程:

 

檢測gcc服務包:

[root@cent001 ~]# rpm -q gcc
gcc-4.4.7-23.el6.x86_64

說明gcc服務包已經安裝。進入”理論步驟“2

 

下載Aache的源碼包(壓縮包形式)並上傳到CENTOS伺服器中:

訪問:http://mirror.bit.edu.cn/apache/httpd/  

找到:httpd-2.4.41.tar.gz  然後下載到本地。

然後通過FTP上傳到CENTOS的個人源碼包專用目錄/usr/local/src  下邊。進入”理論步驟“3

 

解壓源碼包

進入源碼包壓縮包的存儲目錄:

[root@cent001 ~]# cd /usr/local/src

解壓httpd-2.4.41.tar.gz源碼壓縮包(會生成httpd-2.4.41目錄):

[root@cent001 src]# tar -zxvf httpd-2.4.41.tar.gz 

查看解壓後的源碼包大小:(此操作不是必須)

[root@cent001 src]# du -sh httpd-2.4.41

46M httpd-2.4.41

進入源碼包解壓後目錄:

[root@cent001 src]# cd httpd-2.4.41

開始進行”理論步驟“3.1

 

配置:使用 ./configure 進行安裝目錄的設置

執行命令進行配置:(註意:官方手冊推薦使用 /usr/local/apache2 作為httpd的源碼安裝路徑)

[root@cent001 httpd-2.4.41]# ./configure --prefix=/usr/local/apache2
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
configure:
configure: Configuring Apache Portable Runtime library...
configure:
checking for APR... no
configure: error: APR not found. Please read the documentation.

出現問題,大概意思是說apr軟體包不存在,導致配置不成功,它還說讓我們去讀安裝說明文檔(目錄中的INSTALLREADME文檔)

 

首先確認一下,是否apr軟體包真不存在:

[root@cent001 httpd-2.4.41]# rpm -q apr
apr-1.3.9-5.el6_9.1.x86_64

很明顯,apr軟體包已經存在了,這跟配置出錯提示的”APR not found“根本兩相矛盾了。

所以,這時你就猜測地想到:依賴的apr版本衝突了,是完成操作,必須依賴於其它版本的apr。那重新指定依賴的版本行了吧,不使用預設的,於是:

[root@cent001 httpd-2.4.41]# ./configure -help | grep apr
--with-included-apr Use bundled copies of APR/APR-Util
--with-apr=PATH prefix for installed APR or the full path to
apr-config
--with-apr-util=PATH prefix for installed APU or the full path to

可以知道,利用--width-apr=PATH 可以通過配置apr安裝目錄來指定特定版本的apr,於是 ./configure 操作可以重新執行為如下形式:

[root@cent001 httpd-2.4.41]# ./configure --prefix=/usr/local/apache2 --with-apr=能被正確依賴的apr版本的安裝目錄

這時要解決的問題是:

哪個(哪些)版本的apr能夠被正確依賴(由於相容性原因,猜測的話,一般最新版本最好,當然不排除最新版本的apr不相容老舊版本的httpd的情況)

 

由於不是十分肯定是否最新版本apr(或其它軟體包)能被正確依賴,我們在解決辦法有兩個:

辦法-1。按照“Please read the documentation”的提示,去讀INSTALLREADME文檔,以便確定肯定我們上邊的猜測。

辦法-2。嘗試安裝某些版本的apr(或其它軟體包)直到可行,比如嘗試:apr-1.4.2等等。

   *****先按照辦法-1來進行,如果不行的話則進入辦法-2。******

 

 

先按辦法-1去做:

[root@cent001 httpd-2.4.41]# vim INSTALL

然後/apr 搜索一下,可以以下相關內容:

* Consider if you want to use a previously installed APR and
APR-Util (such as those provided with many OSes) or if you
need to use the APR and APR-Util from the apr.apache.org
project. If the latter, download the latest versions and
unpack them to ./srclib/apr and ./srclib/apr-util (no
version numbers in the directory names) and use
./configure's --with-included-apr option. This is required
if you don't have the compiler which the system APR was
built with. It can also be advantageous if you are a
developer who will be linking your code with Apache or using
a debugger to step through server code, as it removes the
possibility of version or compile-option mismatches with APR
and APR-Util code. As a convenience, prepackaged source-code
bundles of APR and APR-Util are occasionally also provided
as a httpd-2.X.X-deps.tar.gz download.

這段內容的大概意思是:

。。。。。。(不說了,看下邊)==>

官方線上的安裝說明文檔(http://httpd.apache.org/docs/2.4/install.html)中還有一個比較簡要的說明:

APR and APR-Util
Make sure you have APR and APR-Util already installed on your system. If you don't, or prefer to not use the system-provided versions, download the latest versions of both APR and APR-Util from Apache APR, unpack them into /httpd_source_tree_root/srclib/apr and /httpd_source_tree_root/srclib/apr-util (be sure the directory names do not have version numbers; for example, the APR distribution must be under /httpd_source_tree_root/srclib/apr/) and use ./configure's --with-included-apr option. On some platforms, you may have to install the corresponding -dev packages to allow httpd to build against your installed copy of APR and APR-Util.
apr 和 apr-Util

確保你系統中已經安裝了apr和apr-Util。如果沒有安裝過,或者安裝了卻不想用它,那就下載最新版本的apr和apr-Util的源碼壓縮包並解壓後放到:httpd源碼目錄/srclib/apr與 和 httpd源碼目錄/srclib/apr-util (命名中不要帶版本號)。例如:

apr源碼必須放在:httpd源碼目錄/srclib/apr 中,並且執行./configure時使用: --with-included-apr

上邊的內容就我們當前的情況來舉例,其操作原由和過程就是:

不想用內置的RPM版本的APR(因為預設使用時發生版本衝突),那就從網址:http://apr.apache.org/  中下載最新的apr與apr-util(其推薦版本為:apr-1.7.0.tar.gz 與 apr-util-1.6.1.tar.gz )

然後解壓為:

apr-1.7.0  目錄,重命名為 apr(即去掉版本號信息) 

apr-util-1.6.1  目錄,重命名為 apr-util(即去掉版本號信息) 

將apr目錄與apr-util目錄複製(或剪貼)到  httpd源碼目錄(即:/usr/local/src/httpd-2.4.41/)

此時httpd源碼目錄為:

/usr/local/src/httpd-2.4.41/

/usr/local/src/httpd-2.4.41/apr

/usr/local/src/httpd-2.4.41/apr-util

。。。

最後,使用:./configure 時,用  --with-included-apr,這是因為:

[root@cent001 httpd-2.4.41]# ./configure -help | grep with-included-apr
--with-included-apr Use bundled copies of APR/APR-Util

可知:配置時使用--with-included-apr,會使用httpd源碼目錄/srclib/下的apr與apr-util
註意:不要被--with-included-apr 名稱迷惑,它同時作用於apr與apr-util。也就是說,沒有:--with-included-apr-util參數項。

 

以上便是官方中提到的說明,它提到的最重要的3條是:

1。最新版本(或當前推薦版本)的apr及apr-util是可用於當前各版本的httpd的,不會出現版本衝突。(我們之前遇到的問題“哪個(哪些)版本的apr能夠被正確依賴” ,這1條就是答案---使用最新版本推薦版本

2。可以使用系統內置的apr和apr-util(我們之前使用的就是這種方式,然後遇到了問題,一步步解決後,剩下的版本問題,並最終到達了上邊第1條)

3。一種用於配置依賴的源碼放置方式及命令參數--with-included-apr進行./configure操作。

 

因為我想以源碼包的形式手動安裝apr與apr-util,所以暫時不按上邊的第3條操作,而是根據第1條,回到我們先前的問題處,即:

[root@cent001 httpd-2.4.41]# ./configure --prefix=/usr/local/apache2 --with-apr=最新版本或推薦版本的apr安裝目錄

由於指定的是“安裝目錄”,所以必須已進行了相應安裝,才存在”安裝目錄“,我們還沒有對最新版本或推薦版本的apr進行安裝,於是,先進行安裝推薦版本的apr:(假設已經下載並解壓)

[root@cent001 apr-1.7.0]# ls
apr-1-config apr.spec config.layout emacs-mode libapr.rc misc README time
apr-config.in atomic config.log encoding libtool mmap README.cmake tools
apr.dep build config.nice file_io LICENSE network_io shmem user
apr.dsp buildconf config.status helpers locks NOTICE strings
apr.dsw build.conf configure include Makefile NWGNUmakefile support
apr.mak build-outputs.mk configure.in libapr.dep Makefile.in passwd tables
apr.pc CHANGES docs libapr.dsp Makefile.win poll test
apr.pc.in CMakeLists.txt dso libapr.mak memory random threadproc

[root@cent001 apr-1.7.0]# vim README

....

Configuring and Building APR on Unix
====================================

Simply;

./configure --prefix=/desired/path/of/apr
make
make test
make install

....

[root@cent001 apr-1.7.0]# ./configure --prefix=/usr/local/apr

[root@cent001 apr-1.7.0]# make

[root@cent001 apr-1.7.0]# make install

至此,最新版本(推薦版本)的apr源碼安裝成功。有了安裝目錄:/usr/local/apr,於是,開始執行以下操作:

[root@cent001 apr-1.7.0] cd /usr/local/src/httpd-2.4.41

[root@cent001 httpd-2.4.41]# ./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr

checking for chosen layout... Apache

checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
configure:
configure: Configuring Apache Portable Runtime library...
configure:
checking for APR... yes
setting CC to "gcc"
setting CPP to "gcc -E"
setting CFLAGS to " -g -O2 -pthread"
setting CPPFLAGS to " -DLINUX -D_REENTRANT -D_GNU_SOURCE"
setting LDFLAGS to " "
configure:
configure: Configuring Apache Portable Runtime Utility library...
configure:
checking for APR-util... no
configure: error: APR-util not found. Please read the documentation.

出現的問題是apr-util找不到,根據之前的官方文檔,發現與apr問題相似,於是,先安裝推薦版本的apr-util(假設已經進行了下載和解壓)

[root@cent001 apr-util-1.6.1]# ls
aprutil.dep build configure.in include Makefile.win redis
aprutil.dsp buildconf crypto ldap memcache renames_pending
aprutil.dsw build.conf dbd libaprutil.dep misc strmatch
aprutil.mak build-outputs.mk dbm libaprutil.dsp NOTICE test
apr-util.pc.in CHANGES docs libaprutil.mak NWGNUmakefile uri
apr-util.spec CMakeLists.txt encoding libaprutil.rc README xlate
apu-config.in config.layout export_vars.sh.in LICENSE README.cmake xml
buckets configure hooks Makefile.in README.FREETDS

[root@cent001 apr-util-1.6.1]# vim README

[root@cent001 apr-util-1.6.1]# ./configure --prefix=/usr/local/apr-util
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking for working mkdir -p... yes
APR-util Version: 1.6.1
checking for chosen layout... apr-util
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
Applying apr-util hints file rules for x86_64-pc-linux-gnu
checking for APR... no
configure: error: APR could not be located. Please use the --with-apr option.

出現錯誤,要求用--with-apr 參數指明apr的安裝路徑,於是:

[root@cent001 apr-util-1.6.1]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr

[root@cent001 apr-util-1.6.1]# make

此時出現錯誤信息有:

xml/apr_xml.c:35:19: 錯誤:expat.h:沒有那個文件或目錄
xml/apr_xml.c:66: 錯誤:expected specifier-qualifier-list before ‘XML_Parser’
xml/apr_xml.c: 在函數‘cleanup_parser’中:
xml/apr_xml.c:364: 錯誤:‘apr_xml_parser’沒有名為‘xp’的成員
xml/apr_xml.c:365: 錯誤:‘apr_xml_parser’沒有名為‘xp’的成員
xml/apr_xml.c: 在文件層:
xml/apr_xml.c:384: 錯誤:expected ‘;’, ‘,’ or ‘)’ before ‘*’ token
xml/apr_xml.c: 在函數‘apr_xml_parser_create’中:
xml/apr_xml.c:401: 錯誤:‘apr_xml_parser’沒有名為‘xp’的成員
xml/apr_xml.c:402: 錯誤:‘apr_xml_parser’沒有名為‘xp’的成員
xml/apr_xml.c:410: 錯誤:‘apr_xml_parser’沒有名為‘xp’的成員
xml/apr_xml.c:411: 錯誤:‘apr_xml_parser’沒有名為‘xp’的成員
xml/apr_xml.c:412: 錯誤:‘apr_xml_parser’沒有名為‘xp’的成員
xml/apr_xml.c:424: 錯誤:‘apr_xml_parser’沒有名為‘xp’的成員
xml/apr_xml.c:424: 錯誤:‘default_handler’未聲明(在此函數內第一次使用)
xml/apr_xml.c:424: 錯誤:(即使在一個函數內多次出現,每個未聲明的標識符在其
xml/apr_xml.c:424: 錯誤:所在的函數內也只報告一次。)
xml/apr_xml.c: 在函數‘do_parse’中:
xml/apr_xml.c:434: 錯誤:‘apr_xml_parser’沒有名為‘xp’的成員
xml/apr_xml.c:438: 錯誤:‘apr_xml_parser’沒有名為‘xp’的成員
xml/apr_xml.c:442: 錯誤:‘apr_xml_parser’沒有名為‘xp_err’的成員
xml/apr_xml.c:442: 錯誤:‘apr_xml_parser’沒有名為‘xp’的成員
xml/apr_xml.c: 在函數‘apr_xml_parser_geterror’中:
xml/apr_xml.c:500: 錯誤:‘apr_xml_parser’沒有名為‘xp_err’的成員
xml/apr_xml.c:500: 錯誤:‘apr_xml_parser’沒有名為‘xp_err’的成員
make[1]: *** [xml/apr_xml.lo] 錯誤 1
make[1]: Leaving directory `/usr/local/src/apr-util-1.6.1'
make: *** [all-recursive] 錯誤 1

百度了一下,根據:https://blog.csdn.net/dn1115680109/article/details/80847924

於是對缺少的expat庫進行安裝:

[root@cent001 apr-util-1.6.1]# yum install -y  expat-devel

執行後就安裝了:expat-devel.x86_64 0:2.0.1-11.el6_2,然後清理後再次編譯:

[root@cent001 apr-util-1.6.1]# make clean

[root@cent001 apr-util-1.6.1]# make

[root@cent001 apr-util-1.6.1]# make install

至此,最新版本(推薦版本)的apr-util 源碼安裝成功。有了安裝目錄:/usr/local/apr-util,於是,開始執行以下操作:

[root@cent001  apr-util-1.6.1] cd /usr/local/src/httpd-2.4.41

[root@cent001 httpd-2.4.41]# ./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util

...

checking whether gcc accepts -g... yes

checking for gcc option to accept ISO C89... none needed

checking how to run the C preprocessor... gcc -E

checking for gcc option to accept ISO C99... -std=gnu99

checking for pcre-config... false

configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/

出錯原因:pcre模塊沒有配置。於是我們查看一下pcre:

[root@cent001 httpd-2.4.41]# rpm -q pcre

pcre-7.8-7.el6.x86_64

說明預設是有的,可能還是版本衝突原因,依據http://pcre.org/下載個最新版(如果該網上不去,可以換成https協議訪問:https://pcre.org/ ,或者訪問:https://sourceforge.net/projects/pcre/files/

下載最新版本的pcre(暫時不用:pcre2):pcre-8.43.tar.gz

[root@cent001 pcre-8.43]# ls

查看到有INSTALL安裝說明文檔

[root@cent001 pcre-8.43]# vim INSTALL

一些安裝說明:

configure、make、make check、make install、make installcheck、

make maintainer-clean、make uninstall、make  distcheck、./configure --help

[root@cent001 pcre-8.43]# ./configure --prefix=/usr/local/pcre

[root@cent001 pcre-8.43]# make

[root@cent001 pcre-8.43]# make install

至此,最新版本的pcre 源碼安裝成功。有了安裝目錄:/usr/local/pcre,於是,開始執行以下操作:

[root@cent001  apr-util-1.6.1] cd /usr/local/src/httpd-2.4.41

[root@cent001 httpd-2.4.41]# ./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util -with-pcre=/usr/local/pcre

...

configure: summary of build options:

Server Version: 2.4.41
Install prefix: /usr/local/apache2
C compiler: gcc -std=gnu99
CFLAGS: -g -O2 -pthread
CPPFLAGS: -DLINUX -D_REENTRANT -D_GNU_SOURCE
LDFLAGS:
LIBS:
C preprocessor: gcc -E

至此,httpd服務安裝過程中的配置正確地完成,進入”理論步驟“3.2

編譯:使用 make 命令直接執行

[root@cent001 httpd-2.4.41]# make clean

[root@cent001 httpd-2.4.41]# 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] 錯誤 1
make[2]: Leaving directory `/usr/local/src/httpd-2.4.41/support'
make[1]: *** [all-recursive] 錯誤 1
make[1]: Leaving directory `/usr/local/src/httpd-2.4.41/support'
make: *** [all-recursive] 錯誤 1

出錯原因:猜測是由於apr-util引起的。

如果是這樣的話,那麼:之前猜想著“官方都極力推薦了那麼應該沒問題”是有問題的,apr-util推薦版本可以針對任何版本都可行這種想法就是錯誤的。

現在是真的是apr-util的問題嗎?推薦版本的apr-util究竟是真的可靠嗎?

明眼看上去,確實apr-util很有問題!官方辦法行不通了,於是採用土法:

 

按辦法-2去做

 

於是更換一下低版本的apr-util 來試試:

重新下載低版本的apr-util:

網址:http://archive.apache.org/dist/apr/  (此網址包含各版本的apr與apr-util,但速度較慢,建議使用百度搜索:archive.apache.org/dist/apr/  然後以百度快照 形式進入下載)

下載 apr-util-1.3.11.tar.gz  (下載速度太慢,有時真的下不動。推薦從其它地方下載)

然後進行解壓。移除之前版本(直接重命名),進行當前版本安裝:

[root@cent001 httpd-2.4.41]# cd /usr/local/

[root@cent001 local]# mv apr-util apr-util.bak2

[root@cent001 local]# cd /usr/local/src/apr-util-1.3.11

[root@cent001 apr-util-1.3.11]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr

[root@cent001 apr-util-1.3.11]# make clean

[root@cent001 apr-util-1.3.11]# make

[root@cent001 apr-util-1.3.11]# make install

至此,apr-util已經替換為低版本,重新執行:

[root@cent001  apr-util-1.6.1] cd /usr/local/src/httpd-2.4.41

[root@cent001 httpd-2.4.41]# ./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util -with-pcre=/usr/local/pcre

[root@cent001 httpd-2.4.41]# make clean

[root@cent001 httpd-2.4.41]# make

至此,編譯任務成功,進入”理論步驟“3.3

 

安裝:使用 make install 命令直接執行

[root@cent001 httpd-2.4.41]# make install

至此,安裝任務成功,進入”理論步驟“4

 這裡直接說明瞭:”官方極力推薦的版本並不一定適用“,比如apr適用,而apr-util就不適用。

啟用httpd服務(運行apache)中,使用瀏覽器訪問

 

啟動服務,使用:安裝目錄/bin/apachectl start    (要停止服務則使用:安裝目錄/bin/apachectl stop)

[root@cent001 httpd-2.4.41]# /usr/local/apache2/bin/apachectl start
AH00557: httpd: apr_sockaddr_info_get() failed for cent001
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message

這種情況,可以參照 https://www.cnblogs.com/xiaoqian1993/p/6027907.html  ,進行2步修改:

1。修改HOSTS文件:

[root@cent001 httpd-2.4.41]# vim /etc/hosts

添加一行(註意其中的cent001為主機名):       127.0.0.1   localhost.localdomain localhost cent001

 

2。修改HTTPD配置文件:

[root@cent001 httpd-2.4.41]# vim /usr/local/apache2/conf/httpd.conf

查找#ServerName,添加一行:ServerName localhost:80

 

再次啟動(或停止後再次啟動):

[root@cent001 httpd-2.4.41]# /usr/local/apache2/bin/apachectl start
瀏覽:http://localhost/       或   http://127.0.0.1       或    http://192.168.253.129    

正常的話顯示:It works!

httpd (pid 119873) already running

至此,整個httpd-2.4.41安裝過程算是暫時可行。另外還有一些其它的問題:系統有時也預設安裝了httpd服務(RPM形式):

 

如果是RMP包的APACHE可以直接進行如下操作:
查看RPM的APACHE版本:
[root@cent001 httpd-2.4.41]# rpm -q httpd
httpd-2.2.15-53.el6.centos.x86_64

或者:

[root@cent001 httpd-2.4.41]# httpd -v
Server version: Apache/2.2.15 (Unix)
Server built: May 11 2016 19:28:33

 

查看RPM的APACHE狀態:
[root@cent001 httpd-2.4.41]# service httpd status
httpd 已停

 

RPM的APACHE啟動方式:

[root@cent001 httpd-2.4.41]# service httpd start

正在啟動 httpd:                                           [確定]

[root@cent001 httpd-2.4.41]# service httpd status
httpd (pid 120138) 正在運行...

使用啟動命令後沒有出錯信息的情況下,通過查詢狀態為“正在運行”就可以表明已經成功啟動服務。

如果啟動失敗,信息如下顯示時,則代表已經有服務占用了80埠(可能是源碼包的APACHE已經啟動了,要使用RPM的APACHE的話就可以先停止源碼版的)
正在啟動 httpd:(98)Address already in use: make_sock: could not bind to address [::]:80
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
[失敗]

另外,如果像源碼版的APACHE服務,啟動時顯示:

AH00557: httpd: apr_sockaddr_info_get() failed for cent001

AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message

則可以按照源碼版,同時修改HOSTS文件及配置文件:

其中HOSTS文件是同一個(即說到HOSTS文件的時候,就是指:/etc/hosts

而RPM版的APACHE的配置文件,是在:/etc/httpd/conf/httpd.conf  (可以通過:# rpm -ql httpd | more  看到)

[root@cent001 httpd-2.4.41]# vim /etc/httpd/conf/httpd.conf

按照上邊源碼版的修改同樣修改就可以!

 

 

==================================================================

    END OF 《Apache源碼包在LINUX(CENTOS6.8)中的安裝(出現問題及解決)》

==================================================================

 


您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • 大漠插件:3.1233 找圖,找色,識字,找字,視窗,按滑鼠,按鍵盤 0、註冊dm.dll; regsvr32 xxx\dm.dll 1、添加com引用; 2、dmsoft各種調用; 原理: 查找視窗hwnd→視窗激活→添加消息到文本框→回車→視窗取消激活 截圖: 代碼: ...
  • 不多說,直接上代碼 web.config如下 其中 SymmetricMethod.Decrypto 解密演算法,至於加解密演算法,大家自行百度吧 ...
  • 在使用vs2019添加mvc控制器的時候 這已經是第二次遇到這個問題了。常言道,多喝熱水,重啟試試。有時候當應用工作不正常,重啟也許能解決問題。但是程式員通常接觸不到伺服器系統許可權。而運維人員和公司流程經常人為製造麻煩阻止我們去重啟應用。 上一次就是通過重啟解決的。 翻牆找了很多解決方案,好似VS團 ...
  • 最近工作中常常有有數據處理的需求,一個Excel動不動就是上十萬的數據量,在用 EPPlus.Core 導入數據入庫的時候遇到了一個莫名其妙的問題 我TM一個導入Excel,解析數據哪裡來的 dictionary??? 然後開始了艱辛的調試debug之旅,反覆上傳導入都不行,然後自己創建了一個格式相 ...
  • 最近遇到了一個部署問題,每次啟動都老是報錯,我的應用程式是基於.NET 4.5.2 VS2015 。用事件查看器 就發現是發生在App啟動的時候。 給代碼加上try..catch 啥也沒抓不上,再後來用同事的機器跑了跑,也沒啥問題。最後實錘是環境問題。 其中安裝Cefsharp完(Nuget)rea ...
  • 概覽 隨著我們的應用程式越來越受歡迎,我們的下一步將要開發多語言功能。方便越來越多的國家使用我們中國的應用程式, 基於 WPF 本地化,我們很多時候使用的是系統資源文件,可是動態切換本地化,就比較麻煩了。 有沒有一種方法既可以適用系統的資源文件,又能方便快捷的切換本地化呢? 實現思路 現在我們將要實 ...
  • 參考資料:https://stackoverflow.com/questions/33399267/cors-error-when-uploading-larger-files https://blog.csdn.net/i2blue/article/details/83892719 單位是 kb ...
  • 到目前為止,我們的MVC+EF Core 完整教程的理論部分就全部結束了,共20篇,覆蓋了核心的主要知識點。 下一階段是實戰部分,我們將會把這些知識點串聯起來,用10篇(天)來完成一個開源項目。 現向園友徵集題材,你提需求我來實現。 請在評論中提出你的需求,並加以簡明扼要的描述。 題材最好是有趣的、 ...
一周排行
    -Advertisement-
    Play Games
  • Dapr Outbox 是1.12中的功能。 本文只介紹Dapr Outbox 執行流程,Dapr Outbox基本用法請閱讀官方文檔 。本文中appID=order-processor,topic=orders 本文前提知識:熟悉Dapr狀態管理、Dapr發佈訂閱和Outbox 模式。 Outbo ...
  • 引言 在前幾章我們深度講解了單元測試和集成測試的基礎知識,這一章我們來講解一下代碼覆蓋率,代碼覆蓋率是單元測試運行的度量值,覆蓋率通常以百分比表示,用於衡量代碼被測試覆蓋的程度,幫助開發人員評估測試用例的質量和代碼的健壯性。常見的覆蓋率包括語句覆蓋率(Line Coverage)、分支覆蓋率(Bra ...
  • 前言 本文介紹瞭如何使用S7.NET庫實現對西門子PLC DB塊數據的讀寫,記錄了使用電腦模擬,模擬PLC,自至完成測試的詳細流程,並重點介紹了在這個過程中的易錯點,供參考。 用到的軟體: 1.Windows環境下鏈路層網路訪問的行業標準工具(WinPcap_4_1_3.exe)下載鏈接:http ...
  • 從依賴倒置原則(Dependency Inversion Principle, DIP)到控制反轉(Inversion of Control, IoC)再到依賴註入(Dependency Injection, DI)的演進過程,我們可以理解為一種逐步抽象和解耦的設計思想。這種思想在C#等面向對象的編 ...
  • 關於Python中的私有屬性和私有方法 Python對於類的成員沒有嚴格的訪問控制限制,這與其他面相對對象語言有區別。關於私有屬性和私有方法,有如下要點: 1、通常我們約定,兩個下劃線開頭的屬性是私有的(private)。其他為公共的(public); 2、類內部可以訪問私有屬性(方法); 3、類外 ...
  • C++ 訪問說明符 訪問說明符是 C++ 中控制類成員(屬性和方法)可訪問性的關鍵字。它們用於封裝類數據並保護其免受意外修改或濫用。 三種訪問說明符: public:允許從類外部的任何地方訪問成員。 private:僅允許在類內部訪問成員。 protected:允許在類內部及其派生類中訪問成員。 示 ...
  • 寫這個隨筆說一下C++的static_cast和dynamic_cast用在子類與父類的指針轉換時的一些事宜。首先,【static_cast,dynamic_cast】【父類指針,子類指針】,兩兩一組,共有4種組合:用 static_cast 父類轉子類、用 static_cast 子類轉父類、使用 ...
  • /******************************************************************************************************** * * * 設計雙向鏈表的介面 * * * * Copyright (c) 2023-2 ...
  • 相信接觸過spring做開發的小伙伴們一定使用過@ComponentScan註解 @ComponentScan("com.wangm.lifecycle") public class AppConfig { } @ComponentScan指定basePackage,將包下的類按照一定規則註冊成Be ...
  • 操作系統 :CentOS 7.6_x64 opensips版本: 2.4.9 python版本:2.7.5 python作為腳本語言,使用起來很方便,查了下opensips的文檔,支持使用python腳本寫邏輯代碼。今天整理下CentOS7環境下opensips2.4.9的python模塊筆記及使用 ...