【移動(dòng)應(yīng)用開發(fā)技術(shù)】apache 編譯安裝與做nagios前端展示_第1頁
【移動(dòng)應(yīng)用開發(fā)技術(shù)】apache 編譯安裝與做nagios前端展示_第2頁
【移動(dòng)應(yīng)用開發(fā)技術(shù)】apache 編譯安裝與做nagios前端展示_第3頁
【移動(dòng)應(yīng)用開發(fā)技術(shù)】apache 編譯安裝與做nagios前端展示_第4頁
【移動(dòng)應(yīng)用開發(fā)技術(shù)】apache 編譯安裝與做nagios前端展示_第5頁
已閱讀5頁,還剩4頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

【移動(dòng)應(yīng)用開發(fā)技術(shù)】apache編譯安裝與做nagios前端展示

一.apache編譯安裝篇1.安裝apache需安裝以下的幾個(gè)包,apr、apr-util、pcre等。

2.下載安裝apr把文件放到/usr/local/src目錄下,tar-zxvf

apr-1.5.2.tar.gzcd

apr-1.5.2./configure--prefix=/usr/local/aprmakemakeinstall

3.下載安裝apr-utiltar-zxvfapr-util-1.5.4.tar.gzcdapr-util-1.5.4./configure--prefix=/usr/local/apr-util

--with-apr=/usr/local/apr#這里配置的時(shí)候要指定apr的安裝路徑。makemakeinstall

4.安裝pcretar-zxvfpcrecdpcre./configure

--prefix=/usr/local/pcremake&&makeinstall

5.安裝apache這里安裝的版本是2.4.18,比較新的版本tar-zxvfhttpd-2.4.18.tar.gzcd

httpd-2.4.18./configure--prefix=/usr/local/apache2--sysconfdir=/etc/httpd--enable-so--enable-ssl--enable-cgi--enable-cgid

--enable-rewrite--enable-deflate--with-z

--with-apr=/usr/local/apr--with-apr-util=/usr/local/apr-util--with-pcre=/usr/local/pcre--with-openssl=/usr/local/ssl

--enable-modules=most--enable-mpms-shared=all--with-mpm=event#各編譯參數(shù)說明--prefix=/usr/local/apache2#

家目錄--sysconfdir=/etc/httpd#配置文件目錄--enable-so#加載動(dòng)態(tài)共享對(duì)象,可實(shí)現(xiàn)模塊動(dòng)態(tài)生效--enable-ssl#支持SSL/TLS,可實(shí)現(xiàn)https訪問--enable-ssl#支持CGI腳本(默認(rèn)對(duì)非線程的MPM模式開啟)--enable-rewrite#啟用Rewirte功能--enable-deflate#支持壓縮--with-zlib#指定zlib庫,不指定自動(dòng)尋找--with-apr=/usr/local/apr#指定apr路徑--with-apr-util=/usr/local/apr-util#指定apr-util路徑--with-pcre=/usr/local/pcre#指定pcre路徑--with-openssl=/usr/local/ssl

#指定openssl的路徑--enable-modules=most#指定動(dòng)態(tài)啟用的模塊--enable-mpms-shared=all#支持動(dòng)態(tài)加載的MPM模塊,可選"all"--with-mpm=event#設(shè)置默認(rèn)啟用的MPM模式makemakeinstall

6.安裝完成后安裝目錄下會(huì)有以下的幾個(gè)目錄bin

build

cgi-bin

conf

error

htdocs

icons

include

logs

man

manual

modules[root@sever9~]#tree-d/usr/local/apache2#安裝目錄樹/usr/local/apache2├──bin#主程序目錄├──build├──cgi-bin#cgi文件存放目錄├──error#發(fā)生錯(cuò)誤時(shí)返回給客戶端的信息│

└──include├──htdocs├──icons#httpd圖標(biāo)文件│

└──small├──include#頭文件├──logs#日志文件├──man#幫助手冊│

├──man1│

└──man8├──manual│

├──developer│

├──faq│

├──howto│

├──p_w_picpaths│

├──misc│

├──mod│

├──platform│

├──programs│

├──rewrite│

├──ssl│

├──style│

├──css│

├──lang│

├──latex│

├──scripts│

└──xsl│

└──util│

└──vhosts└──modules#模塊文件

7.配置目錄下的文件[root@sever9httpd]#tree/etc/httpd/etc/httpd├──extra#擴(kuò)展的配置文件│

├──httpd-autoindex.conf│

├──httpd-dav.conf│

├──httpd-default.conf│

├──httpd-info.conf│

├──httpd-languages.conf│

├──httpd-manual.conf│

├──httpd-mpm.conf│

├──httpd-multilang-errordoc.conf│

├──httpd-ssl.conf│

├──httpd-userdir.conf│

├──httpd-vhosts.conf│

└──proxy-html.conf├──httpd.conf#主配置文件├──magic├──mime.types└──original

├──extra

├──httpd-autoindex.conf

├──httpd-dav.conf

├──httpd-default.conf

├──httpd-info.conf

├──httpd-languages.conf

├──httpd-manual.conf

├──httpd-mpm.conf

├──httpd-multilang-errordoc.conf

├──httpd-ssl.conf

├──httpd-userdir.conf

├──httpd-vhosts.conf

└──proxy-html.conf

└──httpd.conf

8.修改配置文件vim

/etc/httpd/httpd.conf找到下面的該行,把監(jiān)聽端口改成本地的80#ServerName:80ServerName

localhost:80修改httpd的主配置文件,設(shè)置Pid文件的路徑PidFile"/var/run/httpd.pid"修改系統(tǒng)的PATH環(huán)境變量,讓/usr/local/apache2/bin目錄下的命令都可以執(zhí)行:vim/etc/profile.d/httpd.shexportPATH=/usr/local/apache2/bin:$PATHsource/etc/profile.d/httpd.sh檢查下語法[root@sever9~]#httpd-t

SyntaxOK導(dǎo)出頭文件ln-sv/usr/local/apache2/include/usr/local/include/httpd`/usr/local/include/httpd'->`/usr/local/apache2/include'導(dǎo)出man手冊,可以用manhttpd查看http的命令vim/etc/man.configMANPATH/usr/local/apache2/man

9.編輯服務(wù)腳本vim/etc/init.d/httpd#!/bin/bash##httpd

StartupscriptfortheApacheHTTPServer##chkconfig:-8515#description:ApacheisaWorldWideWebserver.

Itisusedtoserve\#

HTMLfilesandCGI.#processname:httpd#config:/etc/httpd/httpd.conf#config:/etc/sysconfig/httpd#pidfile:/var/run/httpd.pid#Sourcefunctionlibrary../etc/rc.d/init.d/functionsif[-f/etc/sysconfig/httpd];then

./etc/sysconfig/httpdfi#StarthttpdintheClocalebydefault.HTTPD_LANG=${HTTPD_LANG-"C"}#Thiswillpreventinitlogfromswallowingupapass-phrasepromptif#mod_sslneedsapass-phrasefromtheuser.INITLOG_ARGS=""#SetHTTPD=/usr/sbin/httpd.workerin/etc/sysconfig/httpdtouseaserver#withthethread-based"worker"MPM;BEWARNEDthatsomemodulesmaynot#workcorrectlywithathread-basedMPM;notablyPHPwillrefusetostart.#Pathtotheapachectlscript,serverbinary,andshort-formformessages.apachectl=/usr/local/apache2/bin/apachectl#apache控制腳本路徑httpd=${HTTPD-/usr/local/apache2/bin/httpd}#apache主程序的路徑prog=httpdpidfile=${PIDFILE-/var/run/httpd.pid}#注意該http.pid文件的路徑lockfile=${LOCKFILE-/var/lock/subsys/httpd}RETVAL=0start(){

echo-n$"Starting$prog:"

LANG=$HTTPD_LANGdaemon--pidfile=${pidfile}$httpd$OPTIONS

RETVAL=$?

echo

[$RETVAL=0]&&touch${lockfile}

return$RETVAL}stop(){

echo-n$"Stopping$prog:"

killproc-p${pidfile}-d10$httpd

RETVAL=$?

echo

[$RETVAL=0]&&rm-f${lockfile}${pidfile}}reload(){

echo-n$"Reloading$prog:"

if!LANG=$HTTPD_LANG$httpd$OPTIONS-t>&/dev/null;then

RETVAL=$?

echo$"notreloadingduetoconfigurationsyntaxerror"

failure$"notreloading$httpdduetoconfigurationsyntaxerror"

else

killproc-p${pidfile}$httpd-HUP

RETVAL=$?

fi

echo}#Seehowwewerecalled.case"$1"instart)

start;;stop)

stop;;status)

status-p${pidfile}$httpd

RETVAL=$?;;restart)

stop

start;;condrestart)

if[-f${pidfile}];then

stop

start

fi;;reload)

reload;;graceful|help|configtest|fullstatus)

$apachectl$@

RETVAL=$?;;*)

echo$"Usage:$prog{start|stop|restart|condrestart|reload|status|fullstatus|graceful|help|configtest}"

exit1esacexit$RETVAL

10.為腳本加執(zhí)行權(quán)限,并啟動(dòng)測試chmod+x/etc/init.d/httpd[root@sever9~]#chmod+x/etc/rc.d/init.d/httpd[root@sever9~]#servicehttpdstartStartinghttpd:

[

OK

]查看監(jiān)聽的端口[root@sever9~]#ss-tnlpLISTEN

0

128

:::80

:::*

users:(("httpd",16817,4),("httpd",16819,4),("httpd",16820,4),("httpd",16821,4))顯示效果如下圖加為系統(tǒng)服務(wù)并設(shè)置自動(dòng)啟動(dòng)chkconfig--addhttpdchkconfighttpdon

二.做nagios前端展示篇

1.編譯安裝php這里我們安裝的版本是5.6.11,tar-jxvf

php-5.6.11.tar.bz2cdphp-5.6.11./configure--prefix=/usr/local/php--with-apxs2=/usr/local/apache2/bin/apxsmake&&makeinstall

2.配置apache支持nagios修改/etc/httpd/httpd.conf的文件把UserdeamonGroupdeamon改為UsernagiosGroupnagios然后找到

<IfModuledir_module>DirectoryIndexindex.html</IfModule>修改為

<IfModuledir_module>DirectoryIndexindex.htmlindex.phpAddTypeapplication/x-httpd-php.php</IfModule>再找到模塊項(xiàng),把下面的幾個(gè)模塊選項(xiàng)注釋去掉。LoadModulecgid_modulemodules/mod_cgid.soLoadModuleactions_modulemodules/mod_actions.so為了安全起見,一般情況下要讓nagios的web監(jiān)控頁面必須經(jīng)過授權(quán)才能訪問,這需要增加驗(yàn)證配置,即在httpd.conf文件最后添加如下信息:定義別名:ScriptAlias/nagios/cgi-bin"/usr/local/nagios/sbin"#nagiosCGI腳本位置<Directory"/usr/local/nagios/sbin">#

SSLRequireSSL

OptionsExecCGI

AllowOverrideNone

Requireallgranted#

Allowfrom

AuthName"NagiosAccess"

AuthTypeBasic

AuthUserFile/usr/local/nagios/etc/htpasswd.users#nagios用戶認(rèn)證文件

Requirevalid-user</Directory>Alias/nagios"/usr/local/nagios/share"#訪問網(wǎng)頁文件路徑別名<

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論