• 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 372 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 (24.3K 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

  • Cyberpunk Aesthetics: What’s in it Special January 27, 2023
  • How to Do Electrical Layout Plan for Adding Smart Switches January 26, 2023
  • What is a Data Mesh? January 25, 2023
  • What is Vehicular Ad-Hoc Network? January 24, 2023
  • Difference Between Panel Light, COB Light, Track Light January 21, 2023

About This Article

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

Source:The Customize Windows, JiMA.in

PC users can consult Corrine Chorney for Security.

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

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

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

We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept”, you consent to the use of ALL the cookies.
Do not sell my personal information.
Cookie SettingsAccept
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
SAVE & ACCEPT