Nginx1.0.11 + PHP5.2.17 + nagios configuration Network Monitoring

Source: Internet
Author: User
Tags imap
In the experimental environment CentOS5.5, Step 1: Install NginxPHP. Before giving you a detailed introduction to LinuxNginx, first let everyone know about LinuxNginx and then give a comprehensive introduction to LinuxNginx. Using LinuxNginx to build a high-performance Web Environment LinuxNginx (enginex) is a high-performance HTTP and reverse proxy server,

In the experimental environment CentOS5.5, Step 1: Install NginxPHP. Before giving you a detailed introduction to Linux Nginx, first let everyone know about Linux Nginx and then give a comprehensive introduction to Linux Nginx. Using Linux Nginx to build a high-performance Web Environment Linux Nginx (engine x) is a high-performance HTTP and reverse proxy server,

Lab environment CentOS5.5


Step 1: Install Nginx + PHP

Before giving you a detailed introduction to Linux Nginx, let's first get to know about Linux Nginx and then give a full introduction to Linux Nginx. Using Linux Nginx to build a high-performance Web Environment Linux Nginx ("engine x") is a high-performance HTTP and reverse proxy server and an IMAP/POP3/SMTP proxy server. Linux Nginx is developed by the Rambler.ru site with the highest access volume in Russia as Igor Sysoev. It has been running on this site for more than two and a half years. Igor publishes source code in the form of a class BSD license.

As Linux Nginx outperforms Apache's high performance and stability, more and more websites are using Linux Nginx as Web servers in China, including Sina Blog, Sina podcast, Netease news and other portal website channels, discuz! Well-known forums such as official forums and the Shui Mu community, and emerging Web 2.0 websites such as Douban, YUPOO album, domestic SNS, and thunder online.

Install the required package
  • Pcre-7.8.tar.gz Regular Expression: ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/
  • Nginx-1.0.11.tar.gz: http://www.nginx.net/
  • Php-5.2.17.tar.gz: http://www.php.net/releases/
  • Php-5.2.17-fpm-0.5.14.diff.gz
  • Php-fpm is a FastCGI management patch for PHP to smoothly change the php. ini configuration without restarting php-cgi: http://php-fpm.anight.org/
  • Note: The PHP version must be the same as that of fpm.

  • Install Nginx environment configuration reference

    ./Configure \

    -- Prefix =/usr/local/nginx \

    With-http_ssl_module \

    With-http_stub_status_module


    Make & make install


    Install PHP Environment Reference (http:// OS .51cto.com/art/201002/183587.htm)

    ./Configure \
    -- Prefix =/usr/local/php \
    -- With-mysql =/usr/local/mysql \
    -- Enable-fastcgi \
    -- Enable-fpm \
    -- With-config-file-path =/usr/local/php/etc \
    -- Enable-force-cgi-redirect \
    -- With-freetype-dir =/usr/local/freetype /\
    -- With-libxml-dir =/usr/local/libxml2 /\
    -- With-jpeg-dir =/usr/local/defaults 8 /\
    -- With-png-dir =/usr/local/libpng /\
    -- With-gd =/usr/local/gd /\
    -- With-crypt =/usr/local/libmcrypt /\
    -- Enable-zip \
    -- With-imap \
    -- With-mcrypt \
    -- With-kerberos \
    -- With-imap-ssl \
    -- Enable-soap \
    -- Enable-mbstring = all \
    -- Enable-sockets


    Step 2: Install nagios

    Http://www.nagios.org/download

    Nagios-3.3.1.tar.gz

    Nagios-plugins-1.4.15.tar.gz

    1. Install nagios

    The process is as follows:
    1. Decompress nagios. tar zxvf nagios-3.3.1.tar.gz
    2. configure nagios. cd nagios;./configure-prefix =/usr/local/nagios
    3. Compile nagios. make all
    4. Install nagios. Unlike installing other software, it takes several steps to install nagios. The first step is to execute make install to install the main program, CGI and HTML files, and the second step is to execute make install-commandmode to grant external commands the permission to access the nagios configuration file, step 3: Run make install-config to copy the configuration file example to the nagios installation directory. Follow the prompts in the installation wizard. In fact, there is also a make install-init step, which is used to make nagios a running script so that nagios can start with the system boot, this is a convenient measure. However, I am a person who prefers to simplify the problem and did not perform such operations.
    5. Check whether the verification program is correctly installed. Switch the directory to the installation path (/usr/local/nagios) to check whether the five directories including etc, bin, sbin, share, and var exist, if yes, it indicates that the program has been correctly installed to the system. The following table provides a brief description of the five directory functions:

    Bin

    The directory where the Nagios executable program is located. This directory has only one file nagios

    Etc

    Location of the Nagios configuration file. After the initial installation, there are only a few *. cfg-sample files.

    Sbin

    The directory where the Nagios Cgi file is located, that is, the directory where the file needed to execute External commands is located

    Share

    Nagios webpage file directory

    Var

    Directory where Nagios log files, spids, and other files are located

    2. Install the nagios plug-in

    There is no plug-in, and nagios does not play any role. The plug-in is also a powerful weapon for nagios extension functions. In addition to downloading common plug-ins, we can also compile our own plug-ins according to actual requirements. Nagios plug-in nagios-plugins-1.4.5 can be found on www.nagios.org, And then we use wget to download it.

    Note: The version between the plug-in and nagios is not associated much, not necessarily with the nagios-plugins-1.4.5 version. After the download is complete, it is easy to install: first execute the configuration./configure-prefix =/usr/local/nagios, then compile and install make; make install.

    The installation path specified during the configuration process is/usr/local/nagios, instead of/usr/local/nagios-plus, the libexec directory will be generated in the/usr/local/nagios directory (which contains many files), which is exactly what nagios needs.


    How do I create a verification file in the etc directory of nagios?


    Step 3: Configure nginx. conf

    Add the following content to the configuration file:

    Server
    {
    Listen 82;
    Server_name localhost;
    Root/usr/local/nagios/share;
    Index. php;
    Location ~ . * \. (Php | php5 )? $
    {
    # Root/usr/local/nagios/share;
    Fastcgi_pass 127.0.0.1: 9000;
    # Fastcgi_pass unix:/tmp/php-cgi.sock;
    Fastcgi_index index. php;
    Fastcgi_param SCRIPT_FILENAME/scripts $ fastcgi_script_name;
    Fastcgi_param HTTP_ACCEPT_LANGUAGE zh-cn;
    Fcinclude gi. conf;
    Auth_basic "Nagios Login pain ";
    Auth_basic_user_file/usr/local/nagios/etc/nagiospasswd; # verify the File Password
    }
    Location ~ . * \. Cgi $ {
    Root/usr/local/nagios/sbin;
    Rewrite ^/nagios/cgi-bin/(. *) \. cgi/$ 1.cgi break;
    # Fastcgi_pass unix:/var/run/nginx-fcgi.sock;
    Fastcgi_pass 127.0.0.1: 9000;
    Include fastcgi_params;
    Fastcgi_index index. cgi;
    Fastcgi_param SCRIPT_FILENAME
    /Usr/local/nagios/sbin/$ fastcgi_script_name;
    Fastcgi_param HTTP_ACCEPT_LANGUAGE zh-cn;
    Fcinclude gi. conf;
    Auth_basic "Nagios Login pain ";
    Auth_basic_user_file/usr/local/nagios/etc/nagiospasswd;
    }
    Location/nagios {
    Alias/usr/local/nagios/share /;
    # Index index.html index.htm index. php;
    # Auth_basic "Nagios Login pain ";
    # Auth_basic_user_file/usr/local/nginx/conf/htpasswd;
    }
    Access_log/var/log/nagios. log;
    }


    Next, test

    Start nagios

    Chkconfig -- add nagios to service

    Set chkconfig nagios on to boot

    Service nagios start service


    Startup Process can refer to (http://bizchen.blog.51cto.com/1802248/340409)


    Enter http: // localhost/nagios/. If it succeeds, the page is displayed.



    Related Article

    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.