On my ubuntu 12.10 server I upgraded php to 5.5. After getting 502 errors on my wordpress site I did some googling and discovered I need to change my nginx configs to match the passing of php scripts to php5-fpm.sock
rather than port 9000. So I changed my site's config file to the below:
# Pass PHP scripts on to PHP-FPM
location ~* \.php$ {
try_files $uri /index.php;
fastcgi_index index.php;
fastcgi_pass unix:/var/run/php5-fpm.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_buffer_size 16k;
fastcgi_buffers 4 16k;
}
I then did service nginx restart
. But the 502 error persists.
Upon checking the error log I get:
2014/03/30 14:16:37 [error] 1451#0: *21 connect() failed (111: Connection refused) while connecting to upstream, client: 81.107.86.251,, server: www.harryg.me, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "harryg.me"
So it looks like php-fpm is trying to pass stuff to fastcgi://127.0.0.1:9000
. Why isn't it obeying the config file change?
edit:
My /etc/php5/fpm/pool.d/www.conf
has listen = /var/run/php5-fpm.sock
in it.