Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm setting up a server with nginx + php-fpm (5.4.11) on ubuntu 12.04 LTS (x64)

I installed nginx from the repository and I compiled PHP myself. Everythings work fine when I start php-fpm and nginx

sudo /etc/init.d/php-5.4.11-fpm start
sudo service nginx start

I can display a phpinfo on a webpage, so far so good.

pid is set like this in /etc/php-5.4.11/php-fpm.conf

pid = /var/run/php-5.4.11/php-fpm.pid

and from /etc/nginx/sites-available/default

location ~ \.php$ {
  fastcgi_split_path_info ^(.+\.php)(/.+)$;
  fastcgi_pass unix:/var/run/php-5.4.11/php-fpm.sock;
  fastcgi_index index.php;
  include fastcgi_params;
}

Now, I would like to start PHP when the server reboots, so I did:

update-rc.d php-5.4.11-fpm defaults

But when I restart the server, I got this error in the log file:

ERROR: unable to bind listening socket for address '/var/run/php-5.4.11/php-fpm.sock': No such file or directory (2)

And indeed, the directory that I created myself /var/run/php-5.4.11/ has disappeared. If I create it again and do sudo /etc/init.d/php-5.4.11-fpm start, it works. But If I restart the server, the directory will be deleted and php-fpm won't start.

What's wrong, I don't get it? Thank you very much!

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Probably, tmpfs is mounted to the /var/run. In other words, this is a RAM-disk and it's clean at OS start.

In this case you should point "pid" and "listen" directives of your php-fpm pool configuration straight to the /var/run:

pid = /var/run/php-fpm.pid

[www]
listen = /var/run/php-fpm.sock
share|improve this answer
    
Thank you, it works! –  JuCachalot Feb 11 '13 at 18:06
    
I wonder if this work if you have multiple vhosts? What happens when they share the same path to sock and pid? –  mr1031011 Nov 3 '13 at 9:05
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.