91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

apache 編譯安裝與做nagios前端展示

發布時間:2020-04-08 07:04:05 來源:網絡 閱讀:577 作者:neijiade10000 欄目:移動開發

一.apache編譯安裝篇


1.安裝apache需安裝以下的幾個包apr 、apr-util、pcre等。

 

2.下載安裝apr

把文件放到/usr/local/src目錄下,

tar -zxvf  apr-1.5.2.tar.gz

cd  apr-1.5.2

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

make

make install

 

3.下載安裝apr-util

tar -zxvf apr-util-1.5.4.tar.gz

cd apr-util-1.5.4

./configure --prefix=/usr/local/apr-util  --with-apr=/usr/local/apr#這里配置的時候要指定apr的安裝路徑。

make

make install

 

4.安裝pcre

tar -zxvf pcre

cd pcre

./configure --prefix=/usr/local/pcre

make && make install

 

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

tar -zxvf httpd-2.4.18.tar.gz

cd  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

#各編譯參數說明

--prefix=/usr/local/apache2 # 家目錄

--sysconfdir=/etc/httpd #配置文件目錄

--enable-so #加載動態共享對象,可實現模塊動態生效

--enable-ssl #支持SSL/TLS,可實現https訪問

--enable-ssl #支持CGI腳本(默認對非線程的MPM模式開啟)

--enable-rewrite #啟用Rewirte功能

--enable-deflate #支持壓縮

--with-zlib#指定zlib庫,不指定自動尋找

--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#指定動態啟用的模塊

--enable-mpms-shared=all #支持動態加載的MPM模塊,可選"all"

--with-mpm=event#設置默認啟用的MPM模式

make

make install


 

6.安裝完成后安裝目錄下會有以下的幾個目錄

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#發生錯誤時返回給客戶端的信息
│   └── include
├── htdocs
├── icons#httpd圖標文件
│   └── 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@sever9 httpd]# tree /etc/httpd
/etc/httpd
├── 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#主配置文件
├── 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

找到下面的該行,把監聽端口改成本地的80

#ServerName www.example.com:80

ServerName  localhost:80

修改httpd的主配置文件,設置Pid文件的路徑

PidFile "/var/run/httpd.pid"
修改系統的PATH環境變量,讓/usr/local/apache2/bin目錄下的命令都可以執行:

vim /etc/profile.d/httpd.sh

export PATH=/usr/local/apache2/bin:$PATH

source /etc/profile.d/httpd.sh

檢查下語法

[root@sever9 ~]# httpd -t 
Syntax OK
導出頭文件

ln -sv /usr/local/apache2/include /usr/local/include/httpd

`/usr/local/include/httpd' -> `/usr/local/apache2/include'

導出man手冊,可以用man httpd查看http的命令

vim /etc/man.config

MANPATH /usr/local/apache2/man

 

9.編輯服務腳本

vim /etc/init.d/httpd

#!/bin/bash
#
# httpd  Startup script for the Apache HTTP Server
#
# chkconfig: - 85 15
# description: Apache is a World Wide Web server.  It is used to serve \
#  HTML files and CGI.
# processname: httpd
# config: /etc/httpd/httpd.conf
# config: /etc/sysconfig/httpd
# pidfile: /var/run/httpd.pid
# Source function library.
. /etc/rc.d/init.d/functions
if [ -f /etc/sysconfig/httpd ]; then
    . /etc/sysconfig/httpd
fi
# Start httpd in the C locale by default.
HTTPD_LANG=${HTTPD_LANG-"C"}
# This will prevent initlog from swallowing up a pass-phrase prompt if
# mod_ssl needs a pass-phrase from the user.
INITLOG_ARGS=""
# Set HTTPD=/usr/sbin/httpd.worker in /etc/sysconfig/httpd to use a server
# with the thread-based "worker" MPM; BE WARNED that some modules may not
# work correctly with a thread-based MPM; notably PHP will refuse to start.
# Path to the apachectl script, server binary, and short-form for messages.
apachectl=/usr/local/apache2/bin/apachectl#apache 控制腳本路徑httpd=${HTTPD-/usr/local/apache2/bin/httpd}#apache 主程序的路徑

prog=httpd
pidfile=${PIDFILE-/var/run/httpd.pid}#注意該http.pid文件的路徑lockfile=${LOCKFILE-/var/lock/subsys/httpd}
RETVAL=0
start() {
  echo -n $"Starting $prog: "
  LANG=$HTTPD_LANG daemon --pidfile=${pidfile} $httpd $OPTIONS
  RETVAL=$?
  echo
  [ $RETVAL = 0 ] && touch ${lockfile}
  return $RETVAL
}
stop() {
   echo -n $"Stopping $prog: "
   killproc -p ${pidfile} -d 10 $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 $"not reloading due to configuration syntax error"
    failure $"not reloading $httpd due to configuration syntax error"
  else
    killproc -p ${pidfile} $httpd -HUP
    RETVAL=$?
  fi
  echo
}
# See how we were called.
case "$1" in
start)
  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}"
  exit 1
esac
exit $RETVAL

 

10.為腳本加執行權限,并啟動測試

chmod +x /etc/init.d/httpd

[root@sever9 ~]# chmod +x /etc/rc.d/init.d/httpd
[root@sever9 ~]# service httpd start
Starting httpd:                                            [  OK  ]
查看監聽的端口

[root@sever9 ~]# ss -tnlp

LISTEN      0      128                                                                      :::80                                                                      :::*      users:(("httpd",16817,4),("httpd",16819,4),("httpd",16820,4),("httpd",16821,4))

顯示效果如下圖

apache 編譯安裝與做nagios前端展示

加為系統服務并設置自動啟動

chkconfig --add httpd

chkconfig httpd on

 

 

二.做nagios前端展示篇

 

1.編譯安裝php

這里我們安裝的版本是5.6.11,

tar -jxvf php-5.6.11.tar.bz2

cd php-5.6.11

./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs

make && make install

 

2.配置apache支持nagios

修改/etc/httpd/httpd.conf的文件

把 User deamon
Group deamon

改為

User nagios

Group nagios

然后找到 

<IfModule dir_module>

DirectoryIndex index.html

</IfModule>

修改為 

<IfModule dir_module>

DirectoryIndex index.html index.php

AddType application/x-httpd-php .php

</IfModule>

再找到模塊項,把下面的幾個模塊選項注釋去掉。

LoadModule cgid_module modules/mod_cgid.so

LoadModule actions_module modules/mod_actions.so

為了安全起見,一般情況下要讓nagios 的web監控頁面必須經過授權才能訪問,這需要增加驗證配置,即在httpd.conf文件最后添加如下信息:

定義別名:

ScriptAlias /nagios/cgi-bin "/usr/local/nagios/sbin"#nagiosCGI腳本位置

<Directory "/usr/local/nagios/sbin">

#  SSLRequireSSL

    Options ExecCGI

    AllowOverride None

    Require all granted

#  Allow from 127.0.0.1

   AuthName "Nagios Access"

   AuthType Basic

   AuthUserFile /usr/local/nagios/etc/htpasswd.users#nagios用戶認證文件

   Require valid-user

</Directory>

Alias /nagios "/usr/local/nagios/share"#訪問網頁文件路徑別名

<Directory "/usr/local/nagios/share">

#  SSLRequireSSL

   Options None

   AllowOverride None   

   Require all granted

#  Order deny,allow

#  Deny from all

#  Allow from 127.0.0.1

   AuthName "Nagios Access"

   AuthType Basic

   AuthUserFile /usr/local/nagios/etc/htpasswd.users

   Require valid-user

</Directory>

 

3.創建apache目錄驗證文件 

在上面的配置中,指定了目錄驗證文件htpasswd,下面要創建這個文件:

/usr/local/apache2/bin/htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

New password: 

Re-type new password: 

Adding password for user nagiosadmin

4.關閉并重啟apache

service httpd restart

啟動apache,報403拒絕訪問,這里是2.4*的版本

要在httpd.conf里改配置文件

<Directory />

    AllowOverride none

    Require all denied

</Directory>

改為

<Directory />

    AllowOverride none

    Require all granted

</Directory>

并重啟apache


nagios展示效果:

打開

http://172.30.65.169/nagios/的頁面,輸入nagios認證用戶名nagiosadmin,和剛設置的密碼


頁面會顯示如下圖所示


apache 編譯安裝與做nagios前端展示

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

烟台市| 乌兰浩特市| 塘沽区| 元谋县| 怀宁县| 登封市| 安塞县| 汽车| 朔州市| 梁山县| 望都县| 明水县| 颍上县| 顺义区| 德安县| 温州市| 绍兴市| 鄂温| 迁西县| 德阳市| 河源市| 万盛区| 兴城市| 吉木萨尔县| 江安县| 石台县| 油尖旺区| 尼勒克县| 福州市| 宜章县| 陇西县| 宜昌市| 庆城县| 射阳县| 齐河县| 邯郸市| 乾安县| 乌拉特后旗| 石门县| 桃源县| 石首市|