• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here: Home » Ngnix Status Graph in PHP5-FPM Setup

By Abhishek Ghosh March 24, 2015 10:12 am Updated on March 24, 2015

Ngnix Status Graph in PHP5-FPM Setup

Advertisement

If We Do Not Create Ngnix Status Graph in PHP5-FPM Setup After Enabling Nginx Status Page, The Fun Remains Incomplete. Easiest Way is Described Here. One of the most search topic around Nginx is how to create Ngnix status graph, it is quite odd – most writes the on how to enable /ping status page or enable /status page; but they do not extend the guides to the next step.

 

Ngnix Status Graph in PHP5-FPM Setup : Work With Easy Setup

 

So, in our guide to enable /status page for Nginx PHP5-FPM setup, we did some works needed for this guide. There are hundreds of monitoring tools including paid stuffs to create Nginx status graph but none of them neither are easy to setup nor light for the server. There is actually very easy way to create graph.

 

Ngnix Status Graph in PHP5-FPM Setup : With Modified PHP Script

 

From the previous guide, this was our vhost file’s main content related to /status :

Advertisement

---

/etc/nginx/sites-available/default
Vim
1
2
3
4
5
6
7
8
9
10
11
location /status {      
access_log off;      
allow 127.0.0.1;
# allow sub.net.ip;      
deny all;       
fastcgi_split_path_info ^(.+.php)(.*)$;       
fastcgi_pass unix:/var/run/php5-fpm.sock;       
fastcgi_index index.php;       
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;       i
nclude fastcgi_params;
}

What we have not added was – stub_status on;. Here is what it does :

Vim
1
http://nginx.org/en/docs/http/ngx_http_stub_status_module.html

Instead of writing so much, we can create alternative / additional location in this way :

/etc/nginx/sites-available/default
Vim
1
2
3
4
location /nginx_status {
        stub_status on;
        access_log off;
    }

For apt version of Nginx (if you have installed Ninx with apt-get install nginx command), that required stuff is actually present :

Vim
1
2
3
4
5
6
nginx -V
# output
nginx version: nginx/1.4.6 (Ubuntu)
built by gcc 4.8.2 (Ubuntu 4.8.2-19ubuntu1)
TLS SNI support enabled
configure arguments: --with-cc-opt='-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_spdy_module --with-http_sub_module --with-http_xslt_module --with-mail --with-mail_ssl_module

If that --with-http_stub_status_module was not present, the thing would not work. So a bit modification :

/etc/nginx/sites-available/default
Vim
1
2
3
4
5
6
7
8
9
10
11
12
location /status {
     access_log off;
        stub_status on;
     #allow 127.0.0.1;
#allow sub.net.ip;
     #deny all;
       fastcgi_split_path_info ^(.+.php)(.*)$;
       fastcgi_pass unix:/var/run/php5-fpm.sock;
       fastcgi_index index.php;
       fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
       include fastcgi_params;
}

We have commented out :

Vim
1
2
3
     #allow 127.0.0.1;
#allow sub.net.ip;
     #deny all;

and added :

Vim
1
        stub_status on;

Saving it, running nginx -t will tell that everything is fine and we can actually do restart :

Vim
1
2
service php5-fpm restart
service nginx restart

If we point our browser towards https://thecustomizewindows.com/status, we will get a basic informative webpage :

Ngnix Status

But, this way if the page is kept open, people will hack us! You can read the nginx documentation about restricting access with username and password :

Vim
1
http://nginx.com/resources/admin-guide/restricting-access/

We saw that, this person :

Vim
1
http://baris.shadowytree.com/?node=blog/nginx%20status

did lot of work but we needed to modify it as our location is different. We can use a better way to password protect the PHP files :

Vim
1
http://php.net/manual/en/features.http-auth.php

So, first I modified that main file uptime.php [you must change the domain name at line 72], you can grab the file here on Github Gist.

/usr/share/nginx/html
Vim
1
2
3
4
5
cd /usr/share/nginx/html
nano uptime.php
## copy pasted the material and saved it
## permission
sudo chown root:www-data /usr/share/nginx/html/uptime.php

Ngnix Status Graph in PHP5-FPM Setup

Now, when we pointed towards this url :

Vim
1
https://thecustomizewindows.com/uptime.php

we received a webpage with stuffs in JSON format. This followed by uploading the files from that blog URL. It did the work we needed.

Nginx community version does not have the ngx_http_status_module. Definitely there are many standalone tools, but this is the easiest way of getting a graph from status.

Tagged With paperuri:(9ec3d27fdc74b35651011a3bad187fee)

This Article Has Been Shared 436 Times!

Facebook Twitter Pinterest
Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to Ngnix Status Graph in PHP5-FPM Setup

  • HHVM WordPress (Nginx Ubuntu Server) Tweaks

    Here are some special HHVM Wordpress (Nginx Ubuntu Server) Tweaks for Page Speed optimization, Compatibility of WordPress Themes and Plugins.

  • Steps To Install Nginx Plus on Ubuntu Server (HP Cloud)

    Here Are the Steps To Install Nginx Plus on Ubuntu Server Running on HP Cloud. Nginx Plus is the Paid Version of Nginx with Extra Features.

  • Zend Opcache Optimization for Nginx Ubuntu (HP Cloud)

    Here is Full Guide to Zend Opcache Optimization for Nginx PHP5-FPM for Ubuntu Server Running on HP Cloud. We Suggest to Use Zend Opcache over APC.

  • Enable Nginx PHP-FPM Status Page (Ubuntu, HP Cloud)

    Here is How To Enable Nginx PHP-FPM Status Page on Ubuntu Server Instance Running on HP Cloud. Enabling Ping Has Difference With Enabling Status.

  • OpenStack Swift : Getting Started From Zero

    OpenStack Swift guide provides you basic set up idea of virtual machine for own Swift development. We have written this guide for the starters who has no idea.

Additionally, performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Subscribe To Our Free Newsletter

Get new posts by email:

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (22.1K Followers)
  • Twitter (5.8k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • Big Data in Sports May 20, 2022
  • FaaS Versus PaaS Deployment: What You Should Know May 18, 2022
  • What Is A Digital Media Consultancy? May 17, 2022
  • How Artificial Intelligence (AI) Is Changing The Way We Play Bingo May 16, 2022
  • Why You Need A Big Data Consultant May 15, 2022

About This Article

Cite this article as: Abhishek Ghosh, "Ngnix Status Graph in PHP5-FPM Setup," in The Customize Windows, March 24, 2015, May 20, 2022, https://thecustomizewindows.com/2015/03/ngnix-status-graph-in-php5-fpm-setup/.

Source:The Customize Windows, JiMA.in

This website uses cookies. If you do not want to allow us to use cookies and/or non-personalized Ads, kindly clear browser cookies after closing this webpage.

Read Privacy Policy.

PC users can consult Corrine Chorney for Security.

Want to know more about us? Read Notability and Mentions & Our Setup.

Copyright © 2022 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy