Apache compilation and installation and Nagios front-end display

Source: Internet
Author: User
Tags mrtg

Apache compilation and installation and Nagios front-end display

Apache compilation and Installation

To install Apache, you need to install the following packages, such as apr-util and pcre. Of course, these packages can also be included in the system, but here we compile and install these packages.

2. Download and install apr,
Put the file in the/usr/local/src directory,
Tar-zxvf apr-1.5.2.tar.gz
Cd apr-1.5.2
./Configure -- prefix =/usr/local/apr/
Make
Make install
3. Download and install
Apr-utils
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/# Set the installation path for apr during configuration.
Make

Make install
4. Install pcre
Tar-zxvf pcre
Cd pcre
./Configure -- prefix =/usr/local/pcre
Make & make install
5. install apache. The version is 2.4.18, which is a new version.
Tar-zxvf httpd-2.4.18.tar.gz
Cd httpd-2.4.18
. /Configure -- with-apr =/usr/local/apr/-- with-apr-util =/usr/local/apr-util/-- with-pcre =/usr/local/ pcre/
Make

Make install
6. After the installation is complete, the following directories are generally available:
Bin build cgi-bin conf error htdocs icons include logs man manual modules
7. modify the configuration file
Vim/usr/local/apache2/conf/httpd. conf
Find the following line and change the listening port to the local 80
# ServerName www.example.com: 80
ServerName localhost: 80
8. Start apache
/Usr/local/apache2/bin/apachectl-k start
9. View Processes

Ps-ef | grep httpd
Root 28310 1 0 10: 11? 00:00:00/usr/local/apache2/bin/httpd-k start
Daemon 28311 28310 0? 00:00:00/usr/local/apache2/bin/httpd-k start
Daemon 28312 28310 0? 00:00:00/usr/local/apache2/bin/httpd-k start
Daemon 28313 28310 0? 00:00:00/usr/local/apache2/bin/httpd-k start
Root 28420 4860 0 00:00:00 pts/1 grep httpd
10. view the port
[Root @ localhost bin] # netstat-tunlp | grep httpd
Tcp 0 0: 80: * LISTEN 28310/httpd
Compile and install php
The installed version is 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

Demonstration of Nagios front-end

Configure apache to support nagios and modify the/usr/local/apache2/conf/httpd. conf file.

Set User deamon

Group deamon
Change
User nagios
Group nagios
Then find
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
Change
<IfModule dir_module>
DirectoryIndex index.html index. php
AddType application/x-httpd-php. php
</IfModule>
Find the module items and remove the comments of the following module options.
LoadModule cgid_module modules/mod_cgid.so
LoadModule actions_module modules/mod_actions.so
For the sake of security, it is generally necessary that the nagios web Monitoring page must be authorized for access. In this case, you need to add the verification configuration, that is, add the following information at the end of the httpd. conf file:
ScriptAlias/nagios/cgi-bin "/usr/local/nagios/sbin" # nagiosCGI script location
<Directory "/usr/local/nagios/sbin">
# SSLRequireSSL
Options ExecCGI
AllowOverride None
Require all granted
# Order deny, allow
# Allow from all
# Allow from 127.0.0.1
AuthName "Nagios Access"
AuthType Basic
AuthUserFile/usr/local/nagios/etc/htpasswd. users # nagios user authentication File
Require valid-user
</Directory>
Alias/nagios "/usr/local/nagios/share" # access the webpage file path Alias
<Directory "/usr/local/nagios/share">
# SSLRequireSSL
Options None
AllowOverride None
Require all granted
# Order allow, deny
# Allow from all
# 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>

 


2. Create an apache directory verification file
In the preceding configuration, the directory authentication file htpasswd is specified. Create this file as follows:
/Usr/local/apache2/bin/htpasswd-c/usr/local/nagios/etc/htpasswd. users nagiosadmin
New password:
Re-type new password:
Adding password for user nagiosadmin

3. Disable and restart apache
Pkill httpd

/Usr/local/apache2/bin/apachectl-k start

Start apache and report 403 Access denied. Here is version 2.4 *.
Modify the configuration file in httpd. conf.
Set
<Directory/>
AllowOverride none
Require all denied
</Directory>
Change

<Directory/>
AllowOverride none
Require all granted
</Directory>
And restart apache

Nagios display results:
Open
Http: // 172.30.65.169/nagios/, enter the nagios authentication username nagiosadmin and the password you just set

The page is displayed, as shown in

-------------------------------------- Split line --------------------------------------

Configure Mrtg in Ubuntu to monitor Nginx and server system resources

Use snmp + Mrtg to monitor Linux systems

Mrtg server construction (Network Traffic Monitoring)

Network Monitor Nagios Overview

Nagios construction and Configuration

Build a Nagios monitoring platform in the Nginx Environment

Configure the basic Nagios System on RHEL5.3 (using Nagios-3.1.2)

CentOS 5.5 + Nginx + Nagios monitoring and control terminal installation and Configuration Guide

Install Nagios Core for Ubuntu 13.10 Server

-------------------------------------- Split line --------------------------------------

Nagios details: click here
Nagios: click here

This article permanently updates the link address:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.