Help with nginx setup with server-status

Mark Haney mark.haney at
Mon Jun 15 19:26:57 UTC 2015

Hopefully, someone has had to do what I'm having trouble doing.  We just
moved to nginx and php5-fpm for our joomla site.  I've had little nginx
experience, so I'm learning on the fly.  I've got a problem I can't quite
figure out how to get working with nginx.

We run a SSL only site, so I've got SSL configured and running fine.  The
problem is, I want to monitor the server status  with the Percona cacti
monitoring templates.  This lets cacti ssh into the server and query
localhost/server-status for the data and then pulls that to my cacti

The problem is that I can't get the configuration right to let localhost
resolve to HTTP and not redirect to HTTPS.  Here's my site config:

 server {
      listen         80;
      server_name    spock;
      return         301 https://$server_name$request_uri;

 server {
       listen 443 default_server ssl;
       server_name     _;
       .....{SSL and rest of config}

server {
       #listen 80 default_server;
       listen 443;
       #listen [::]:443 default_server ipv6only=on;

       root /var/www;
       index index.php index.html index.htm;


The problem is, if I try  to setup the basic server-status configuration:
(Commented out on purpose)
 #server {
#       listen          80;
#       server_name     localhost;
#               location /server-status {
#                stub_status on;
#                allow;
               # deny all;
#        }

the return 301 redirect redirects to https://spock and fails to get me to
the server-status page.

I'm kind of lost on how to make this work.  I just want the status page
available to localhost only and via HTTP.  So far, I'm impressed with
nginx, but this one has me stumped.



Mark Haney ::: Senior Systems Engineer
*VIF* International Education
P.O. Box 3566 ::: Chapel Hill, N.C. 27515 ::: USA
919-265-5006 office

Global learning for all.
Find VIF on Facebook <> |
Twitter <> | LinkedIn

Recognized as a ‘Best for the World’
<> B Corp!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the ubuntu-users mailing list