Accessing PHP-FPM's Status Page

Steve Holdoway steve at greengecko.co.nz
Fri Jun 21 03:02:26 UTC 2013


fastcgi_param	QUERY_STRING		$query_string;
fastcgi_param	REQUEST_METHOD		$request_method;
fastcgi_param	CONTENT_TYPE		$content_type;
fastcgi_param	CONTENT_LENGTH		$content_length;

fastcgi_param	SCRIPT_FILENAME		$request_filename;
fastcgi_param	SCRIPT_NAME		$fastcgi_script_name;
fastcgi_param	REQUEST_URI		$request_uri;
fastcgi_param	DOCUMENT_URI		$document_uri;
fastcgi_param	DOCUMENT_ROOT		$document_root;
fastcgi_param	SERVER_PROTOCOL		$server_protocol;

fastcgi_param	GATEWAY_INTERFACE	CGI/1.1;
fastcgi_param	SERVER_SOFTWARE		nginx/$nginx_version;

fastcgi_param	REMOTE_ADDR		$remote_addr;
fastcgi_param	REMOTE_PORT		$remote_port;
fastcgi_param	SERVER_ADDR		$server_addr;
fastcgi_param	SERVER_PORT		$server_port;
fastcgi_param	SERVER_NAME		$server_name;

# GeoIP - just country at the moment.
fastcgi_param GEOIP_COUNTRY_CODE $geoip_country_code; 

# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param	REDIRECT_STATUS		200;

fastcgi_connect_timeout			60;
fastcgi_send_timeout			1800;
fastcgi_read_timeout			1800;
fastcgi_buffer_size			128k;
fastcgi_buffers				8 256k;
fastcgi_busy_buffers_size		256k;
fastcgi_temp_file_write_size		256k;
fastcgi_intercept_errors		on;


On Thu, 2013-06-20 at 22:50 -0400, Schiz0 wrote:
> I don't know why, but it is simply not working for me. I tried
> changing my SCRIPT_FILENAME to match yours exactly, and I changed my
> location block to "location ~ ^/fpm-status$ {}" - as opposed to using
> "=". Same problems.
> 
> 
> I also tried toggling fastcgi_intercept_errors to see if that did
> anything.
> 
> 
> 
> May I ask to see your fastcgi_params file?
> 
> 
> 
> On Thu, Jun 20, 2013 at 10:41 PM, Steve Holdoway
> <steve at greengecko.co.nz> wrote:
>         On Thu, 2013-06-20 at 22:31 -0400, Schiz0 wrote:
>         > Hello list,
>         >
>         >
>         > I use php-fpm via fastcgi to handle my PHP scripts. I have
>         that
>         > working successfully. PHP-FPM has a feature where it
>         displays a status
>         > page, as mentioned here:
>         >
>         http://php.net/manual/en/install.fpm.configuration.php#pm.status-path
>         >
>         >
>         > I'd like to be able to access this through nginx. I tried
>         setting my
>         > configuration to what I would expect to work, but, alas, it
>         does not.
>         >
>         > Here's my configuration:
>         > http://p.ngx.cc/042567f732ada334
>         >
>         >
>         > The error I get when I try to browse to
>         domain.com/fpm-status is:
>         > "File not found."
>         >
>         > in my browser, and in the nginx error log:
>         >
>         > 2013/06/20 22:29:51 [error] 85006#0: *13 FastCGI sent in
>         stderr:
>         > "Primary script unknown" while reading response header from
>         upstream,
>         > client: x.x.x.132, server: domain.com, request:
>         "GET /fpm-status
>         > HTTP/1.1", upstream: "fastcgi://unix:/var/run/phpfpm.sock:",
>         host:
>         > "domain.com"
>         >
>         >
>         > Nothing shows up in php-fpm's error log.
>         >
>         > Thanks for any help/suggestions on getting this working!
>         
>         
>         For me,
>         location ~ ^/(status|ping|apc_info.php)$ {
>             include fastcgi_params;
>             fastcgi_param SCRIPT_FILENAME $document_root
>         $fastcgi_script_name;
>             fastcgi_pass backend;
>             allow 127.0.0.1;
>             deny all;
>         }
>         
>         with
>         pm.status_path = /status
>         
>         in the pool definition works fine.
>         
>         I use a stub config just to manage 127.0.0.1 access, which
>         include a
>         load of monitoring stuff.
>         
>         hth,
>         
>         Steve
>         
>         
>         
>         
>         --
>         Steve Holdoway BSc(Hons) MNZCS
>         http://www.greengecko.co.nz
>         Linkedin: http://www.linkedin.com/in/steveholdoway
>         Skype: sholdowa
>         
>         _______________________________________________
>         nginx mailing list
>         nginx at nginx.org
>         http://mailman.nginx.org/mailman/listinfo/nginx
> 
> 
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx

-- 
Steve Holdoway BSc(Hons) MNZCS 
http://www.greengecko.co.nz
Linkedin: http://www.linkedin.com/in/steveholdoway
Skype: sholdowa



More information about the nginx mailing list