Home php教程 php手册 Nginx1.0.11+PHP5.2.17+nagios配置网络监控

Nginx1.0.11+PHP5.2.17+nagios配置网络监控

Jun 06, 2016 pm 07:53 PM
match

实验环境CentOS5.5 第一步:安装NginxPHP 在向大家详细介绍Linux Nginx之前,首先让大家了解下Linux Nginx,然后全面介绍Linux Nginx,希望对大家有用。利用Linux Nginx架设高性能的Web环境 Linux Nginx (engine x) 是一个高性能的 HTTP 和反向代理服务器,

实验环境CentOS5.5


第一步:安装Nginx+PHP

在向大家详细介绍Linux Nginx之前,首先让大家了解下Linux Nginx,然后全面介绍Linux Nginx,希望对大家有用。利用Linux Nginx架设高性能的Web环境 Linux Nginx ("engine x") 是一个高性能的 HTTP 和反向代理服务器,也是一个 IMAP/POP3/SMTP 代理服务器。 Linux Nginx 是由 Igor Sysoev 为俄罗斯访问量第二的 Rambler.ru 站点开发的,它已经在该站点运行超过两年半了。Igor 将源代码以类BSD许可证的形式发布。

Linux Nginx 超越 Apache 的高性能和稳定性,使得国内使用Linux Nginx作为 Web 服务器的网站也越来越多,其中包括新浪博客、新浪播客、网易新闻等门户网站频道,六间房、56.com等视频分享网站,Discuz!官方论坛、水木社区等知名论坛,豆瓣、YUPOO相册、海内SNS、迅雷在线等新兴Web 2.0网站。

安装需要的包
Copy after login
  • pcre-7.8.tar.gz      正则表达式下载地址: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是为PHP打的一个FastCGI管理补丁,可以平滑变更php.ini配置而无需重启php-cgi下载地址:http://php-fpm.anight.org/  
  • 注:PHP的版本要和fpm的版本一致

  • 安装Nginx环境配置参考

    ./configure \

    --prefix=/usr/local/nginx \

    --with-http_ssl_module \

    --with-http_stub_status_module


    make && make install


    安装PHP环境参考(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/jpeg8/ \
    --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


    第二步:安装nagios

    下载地址http://www.nagios.org/download

    nagios-3.3.1.tar.gz

    nagios-plugins-1.4.15.tar.gz

    一、安装nagios

    过程如下:
    1、解压nagios. tar zxvf nagios-3.3.1.tar.gz
    2、配置nagios. cd nagios ; ./configure –prefix=/usr/local/nagios
    3、编译nagios. make all
    4、安装nagios。与别的软件安装稍有不同,nagios的安装要好几步才能完成。第一步执行make install安装主要的程序、CGI及HTML文件,第二步执行 make install-commandmode 给外部命令访问nagios配置文件的权限,第三步执行 make install-config 把配置文件的例子复制到nagios的安装目录。按照安装向导的提示,其实这里还有一个 make install-init的步骤,它的作用是把nagios做成一个运行脚本,使nagios随系统开机启动,这是一个很方便的措施。但本人是一个喜欢把问题简化的人,没有执行这样的操作。
    5、验证程序是否被正确安装。切换目录到安装路径(这里是/usr/local/nagios),看是否存在 etc、bin、 sbin、 share、 var这五个目录,如果存在则可以表明程序被正确的安装到系统了。后表是五个目录功能的简要说明:

    bin

    Nagios执行程序所在目录,这个目录只有一个文件nagios

    etc

    Nagios配置文件位置,初始安装完后,只有几个*.cfg-sample文件

    sbin

    Nagios Cgi文件所在目录,也就是执行外部命令所需文件所在的目录

    Share

    Nagios网页文件所在的目录

    Var

    Nagios日志文件、spid 等文件所在的目录

    二、安装nagios的插件

    没有插件,nagios将什么作用也没有,插件也是nagios扩展功能的强大武器,除了下载常用的插件外,我们还可以根据实际要求编写自己的插件。Nagios的插件nagios-plugins-1.4.5在www.nagios.org上可以找到,接着我们用wget下载它。

    注意:插件与nagios之间的版本关联不大,不一定非得用nagios-plugins-1.4.5这个版本。下载完成后,安装它是很简单的:先执行配置 ./configure –prefix=/usr/local/nagios ,接着编译安装 make ; make install即可。

    这里需要说明一下的是在配置过程指定的安装路径是/usr/local/nagios,而不是/usr/local/nagios-plus,安装完成后,将在目录/usr/local/nagios生成目录libexec(里面有很多文件),这正是nagios所需要的。


    如何需要验证 在nagios的etc目录下创建验证文件


    第三步:配置nginx.conf

    在配置文件中加入以下内容:

    server
    {
        listen 82;
        server_name localhost;
        root /usr/local/nagios/share;
        index 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;
            include fcgi.conf;
            auth_basic "Nagios Login pain";
            auth_basic_user_file /usr/local/nagios/etc/nagiospasswd;  # 验证的文件密码
        }
        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;
            include fcgi.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;
    }


    接下来测试

    启动nagios

    chkconfig --add nagios 添加到service 中

    chkconfig nagios on 设置成开机启动

    service nagios start 启动服务


    启动过程可以参考(http://bizchen.blog.51cto.com/1802248/340409/)


    输入http://localhost/nagios/如果顺利则显示界面

    Nginx1.0.11+PHP5.2.17+nagios配置网络监控


    Statement of this Website
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

    Hot AI Tools

    Undresser.AI Undress

    Undresser.AI Undress

    AI-powered app for creating realistic nude photos

    AI Clothes Remover

    AI Clothes Remover

    Online AI tool for removing clothes from photos.

    Undress AI Tool

    Undress AI Tool

    Undress images for free

    Clothoff.io

    Clothoff.io

    AI clothes remover

    Video Face Swap

    Video Face Swap

    Swap faces in any video effortlessly with our completely free AI face swap tool!

    Hot Article

    Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
    3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
    Nordhold: Fusion System, Explained
    3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
    Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
    3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

    Hot Tools

    Notepad++7.3.1

    Notepad++7.3.1

    Easy-to-use and free code editor

    SublimeText3 Chinese version

    SublimeText3 Chinese version

    Chinese version, very easy to use

    Zend Studio 13.0.1

    Zend Studio 13.0.1

    Powerful PHP integrated development environment

    Dreamweaver CS6

    Dreamweaver CS6

    Visual web development tools

    SublimeText3 Mac version

    SublimeText3 Mac version

    God-level code editing software (SublimeText3)

    Hot Topics

    Java Tutorial
    1665
    14
    PHP Tutorial
    1269
    29
    C# Tutorial
    1249
    24
    What is the best graphics card for i7 3770? What is the best graphics card for i7 3770? Dec 29, 2023 am 09:12 AM

    What graphics card is good for Core i73770? RTX3070 is a very powerful graphics card with excellent performance and advanced technology. Whether you're playing games, rendering graphics, or performing machine learning, the RTX3070 can handle it with ease. It uses NVIDIA's Ampere architecture, has 5888 CUDA cores and 8GB of GDDR6 memory, which can provide a smooth gaming experience and high-quality graphics effects. RTX3070 also supports ray tracing technology, which can present realistic light and shadow effects. All in all, the RTX3070 is a powerful and advanced graphics card suitable for those who pursue high performance and high quality. RTX3070 is an NVIDIA series graphics card. Powered by 2nd generation NVID

    i73770 with rx5600xt (i73770 with rx5600xt) i73770 with rx5600xt (i73770 with rx5600xt) Jan 04, 2024 am 11:26 AM

    i73770 with rx5600xt Because the RX5600XT graphics card is matched with the R53600CPU, we chose the i7-3770. The evaluation results of the RX5600XT graphics card are as follows: The RX5600XT graphics card is an excellent graphics card and performed very well after testing. It adopts AMD's RDNA architecture, has 6GBGDDR6 video memory and 192-bit memory interface, supports PCIe4.0 bus, and has excellent gaming performance. In all tests, the RX5600XT graphics card performed well. At high resolutions, it delivers a smooth gaming experience and maintains frame rates above 60 FPS in most games. In the latest games, it can also provide good

    Is it suitable to match 11600kf with 3070? Is it suitable to match 11600kf with 3070? Jan 02, 2024 am 11:54 AM

    Is it reasonable to use 13600kf with 3070? "Words Play with Flowers" is a popular text puzzle game with new levels updated every day. Among them, Nostalgia Cleaning is one of the levels, which requires players to find 12 places in the picture that do not match the era. Today, I will share with you the strategy for clearing the nostalgic cleaning level of "Word Play Flowers", so that players who have not yet cleared the level will know the specific operation methods. If it is used to play games, then there is no difference between I513600KF and I713700KF in terms of gaming experience. In this case, just choose I513600KF for the CPU. For the graphics card, you can choose RTX3070. It should be noted that different games have different hardware requirements. If the little cutie just plays DOTALO

    How to choose the right motherboard computer accessories to improve the performance of Xiaomi computers? How to choose the right motherboard computer accessories to improve the performance of Xiaomi computers? Dec 28, 2023 am 10:11 AM

    Which motherboard is better for Xiaomi computers? In today's era of rapid development of information technology, computers have become one of the indispensable tools in people's lives. When choosing a computer, the motherboard is one of the most important components. As a well-known technology company, Xiaomi has also launched a series of high-performance computer products. So, what kind of motherboard should Xiaomi choose? This article will elaborate on performance from multiple aspects such as performance, stability, scalability and brand reputation. Performance is one of the most important considerations when choosing a motherboard. Xiaomi's high-end computers have the highest configurations, so you need to choose a motherboard with powerful performance to match. We can consider choosing a motherboard that supports the latest generation of processors, such as Intel's 10th generation Core processors. Motherboard memory and storage expansion

    Which motherboard is suitable for Core 10th generation i5_mx330? Which motherboard is suitable for Core 10th generation i5_mx330? Dec 27, 2023 pm 02:17 PM

    1. MX330 chassis overview MX330 is a mid-tower chassis produced by Shenzhen Hangjia Technology Co., Ltd. It has a simple and elegant appearance and is made of high-quality steel plates. It has excellent cooling performance and scalability, and is very suitable for use with high-performance motherboards and processors 2. Introduction to the Core 10th Generation i5 processor The Core 10th Generation i5 processor is a high-performance processor launched by Intel. Using a 10nm process, it has higher frequency and lower power consumption. It has powerful multi-core processing capabilities and intelligent acceleration technology, which can meet the daily use needs and light gaming needs of most users. 3. The heat dissipation performance of the MX330 chassis. The design of the MX330 chassis adopts an all-black grid style. The front and top are equipped with large-area meshes, which can

    Recommended minimum CPU suitable for 1150 motherboard Recommended minimum CPU suitable for 1150 motherboard Jan 04, 2024 pm 09:22 PM

    When choosing the lowest-end central processing unit (CPU), it's important to balance affordability with basic needs. For users using 1150 motherboards, choosing a suitable minimum configuration CPU can meet the needs of daily office work, web browsing and light entertainment. This article will recommend several suitable CPUs for you in terms of performance, price, power consumption, and scalability. Among the selections of the lowest-performance CPU, performance is an important consideration. For general office and light entertainment users, a quad-core processor is enough to meet the needs. Intel's i3 series and PentiumG series are both good choices. The i3 series has higher performance and larger cache, suitable for handling multi-tasking and multi-threaded applications. The PentiumG series is

    Choose the right mouse for your laptop Choose the right mouse for your laptop Jan 02, 2024 pm 09:54 PM

    What kind of mouse should I use with my laptop? It is best to use a wireless mouse. 1. The wireless mouse does not have the problem of wires getting tangled together, making the operation more convenient. 2. Equipped with a wireless mouse, you can avoid cluttered cables and provide more freedom when moving. 3. There is no need to use a cable to connect the wireless mouse to the notebook, and the cable will not be easily pulled out, making the use experience better. 4. In situations such as business trips, wireless mice are more convenient to carry. When using a mouse with a laptop, you should choose a wireless mouse. Because a wireless mouse does not require a cable, it is more convenient to use and can avoid tangles in the cable. At the same time, the sensitivity and response speed of a wireless mouse are better than that of a wired mouse, which can improve work efficiency. If you need to use it for a long time, it is recommended to choose a charging

    Is it suitable to pair i56500 with GTX1070 (Is it suitable to pair i56500 with GTX1070) Is it suitable to pair i56500 with GTX1070 (Is it suitable to pair i56500 with GTX1070) Jan 08, 2024 am 08:25 AM

    Is it suitable to pair i56500 with GTX1070? If you want to be more serious, the answer is no. But based on the actual situation, there is no problem with this combination. Why say no? Because for those large-scale stand-alone games that require more configuration now, if you use i76700k or i56500 with gtx1070, and the other configurations and settings are the same, the frame rate will usually be different, and the frame rate of 6700k will tend to be higher. In fact, this is more like the barrel principle. It is not a question of whether you can afford it or not. The key lies in how high the demand for the CPU is in the game. But considering the compatibility of i56500 and gtx1070 in most games, the frame rate has already Pretty impressive and capable of providing a great gaming experience, so something like this

    See all articles