# Fastcgi retry upstream (transparent php-fpm restart)?

**URL:** <https://www.ruby-forum.com/t/fastcgi-retry-upstream-transparent-php-fpm-restart/242622>\
**Category:** NGINX\
**Created:** [July 8, 2015, 11:14am UTC](https://www.ruby-forum.com/t/fastcgi-retry-upstream-transparent-php-fpm-restart/242622 "2015-07-08T11:14:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![musicdenotation](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ea666f/32.png) [@musicdenotation](https://www.ruby-forum.com/u/musicdenotation)\
**Post date:** [July 8, 2015, 11:14am UTC](https://www.ruby-forum.com/t/fastcgi-retry-upstream-transparent-php-fpm-restart/242622/1 "2015-07-08T11:14:41Z")

</div>

Hi,

I’m using nginx with 1 php-fpm (via unix socket), and i’m wondering if  
there is a way to make nginx retry on error, something like  
fastcgi\_next\_upstream but for the same upstream.

I would like to be able to transparently restart php-fpm and not send  
some  
502 to the clients

So, is there a way to make nginx retry the same upstream for X seconds  
(or  
retry every Y seconds for max Z attempts or …) (on errors like  
“connect()  
failed (111: Connection refused) while connecting to upstream”) ?

I’m open to any tricks

Thanks in advance  
Etienne

p.s: I already know about atomic/transparent php deployment with  
“$realpath\_root” and multiple docroot (

> <https://github.com/zendtech/ZendOptimizerPlus/issues/126#issuecomment-24020445>
>
> Hi!
> 
> We are trying to use your opcode cache with our project.
> Our code versions …are managed in production with symlinks. Sometimes it seems that opcode cacher timestamp invalidation fails after project symlink is changed and we need to clear the cache manually.
> 
> \`\`\`
> /somefolder
> /production -\> 20130823\_2207
> /20130823\_2207
> /20130823\_2115
> ...
> \`\`\`
> 
> Can you help us with any advice? Thank you.
> 
> Versions:
> 
> \`\`\`
> PHP 5.5.1-1
> Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies
> with Zend OPcache v7.0.2-dev, Copyright (c) 1999-2013, by Zend Technologies
> \`\`\`
> 
> Config:
> 
> \`\`\`
> opcache.blacklist\_filename =\> no value
> opcache.consistency\_checks =\> 0
> opcache.dups\_fix =\> Off
> opcache.enable =\> On
> opcache.enable\_cli =\> Off
> opcache.enable\_file\_override =\> Off
> opcache.error\_log =\> no value
> opcache.fast\_shutdown =\> 0
> opcache.force\_restart\_timeout =\> 180
> opcache.inherited\_hack =\> On
> opcache.interned\_strings\_buffer =\> 4
> opcache.load\_comments =\> 1
> opcache.log\_verbosity\_level =\> 1
> opcache.max\_accelerated\_files =\> 2000
> opcache.max\_file\_size =\> 0
> opcache.max\_wasted\_percentage =\> 5
> opcache.memory\_consumption =\> 64
> opcache.optimization\_level =\> 0xFFFFFFFF
> opcache.preferred\_memory\_model =\> no value
> opcache.protect\_memory =\> 0
> opcache.revalidate\_freq =\> 2
> opcache.revalidate\_path =\> Off
> opcache.save\_comments =\> 1
> opcache.use\_cwd =\> On
> opcache.validate\_timestamps =\> On
> \`\`\`

)
