View Single Post
Old 28th March 2012, 16:44
37minutes 37minutes is offline
Junior Member
Join Date: Mar 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default nginx + PHP5-FPM: eventual 500 errors for single site


I've just setup my nginx <--socket--> php5-fpm web server. It's working pretty well except for one problem: on one of my php sites, when I browse around to different pages, I eventually get a 500 error. And once it shows up, I'll get 500 errors for the rest of the site until I restart php5-fpm. But *not* on other php sites being hosted on the same server! I have several Wordpress installations using the same php socket, and they work fine even after the 500 errors show up on this certain site.

What could possibly be the problem? I've looked in all the logs I could find, but they don't show what's causing the problem. (e.g., the php5-fpm log just says that it is running and ready to accept connections; the nginx log doesn't print anything in the error log--it just prints the GET request in the access log)

The problematic site's nginx configuration:

    server {

        listen       80;
		root   		 /srv/www/;

		location / {
		index index.html index.htm index.php;

		if (!-e $request_filename) {
		rewrite ^(.+)$ /index.php?q=$1 last;

		location ~ \.php$ {
		try_files $uri =404;
    	fastcgi_pass unix:/var/run/php5-fpm.sock;
    	fastcgi_index index.php;
		fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    	include /etc/nginx/fastcgi_params;


My php5-fpm.conf:


user = www-data
group = www-data

listen = /var/run/php5-fpm.sock
listen.mode = 0666

pm = static

pm.max_children = 15
pm.max_requests = 100
request_terminate_timeout = 30s

env[PATH] = /usr/local/bin:/usr/bin:/bin
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp

php_admin_value[error_log] = /var/log/fpm-php.www.log
php_admin_flag[log_errors] = on
php_admin_value[memory_limit] = 128M

My fastcgi_params:

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;

fastcgi_param	REDIRECT_STATUS		200;
fastcgi_buffers 256 16k;
fastcgi_buffer_size 32k;

Last edited by 37minutes; 28th March 2012 at 16:53.
Reply With Quote
Sponsored Links