<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">28 ноября 2017 г., 20:52 пользователь Иван <span dir="ltr"><<a href="mailto:nginx@kinetiksoft.com" target="_blank">nginx@kinetiksoft.com</a>></span> написал:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><u></u>
<div style="font-family:"Noto Sans";font-size:12pt;font-weight:400;font-style:normal">
<p style="margin:0px;text-indent:0px">Здравствуйте!</p>
<p style="margin:0px;text-indent:0px"> </p>
<p style="margin:0px;text-indent:0px">nginx 1.12.2, debian 8, php-fpm (5.6)</p>
<p style="margin:0px;text-indent:0px"><span style="font-family:"monospace";font-weight:600;color:rgb(255,84,84);background-color:rgb(255,255,255)"># </span><span style="font-family:"monospace";color:rgb(0,0,0);background-color:rgb(255,255,255)">nginx -V </span><span style="font-family:"monospace""><br>nginx version: nginx/1.12.2 <br>built by gcc 4.9.2 (Debian 4.9.2-10)  <br>built with OpenSSL 1.0.1t  3 May 2016 <br>TLS SNI support enabled <br>configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib/nginx/<wbr>modules --conf-path=/etc/nginx/nginx.<wbr>conf --error-log-path=/va<br>r/log/nginx/error.log --http-log-path=/var/log/<wbr>nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.<wbr>lock --http-client-body-temp-path=/<wbr>var/c<br>ache/nginx/client_temp --http-proxy-temp-path=/var/<wbr>cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/<wbr>cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/<wbr>cach<br>e/nginx/uwsgi_temp --http-scgi-temp-path=/var/<wbr>cache/nginx/scgi_temp --user=nginx --group=nginx --with-compat --with-file-aio --with-threads --with-http_addition_<br>module --with-http_auth_request_<wbr>module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_mod<br>ule --with-http_random_index_<wbr>module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_sta<br>tus_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --w<br>ith-stream_ssl_preread_module --with-cc-opt='-g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fPIC' --with-ld-opt='-Wl,-<br>z,relro -Wl,-z,now -Wl,--as-needed -pie'<br></span></p>
<p style="margin:0px;text-indent:0px"> </p>
<p style="margin:0px;text-indent:0px">Есть самописное приложение на php. У него есть две версии: stable и current. Для быстрой смены используется следующая схема:</p>
<p style="margin:0px;text-indent:0px">/var/www/stable/ - тут лежит stable</p>
<p style="margin:0px;text-indent:0px">/var/www/current/ - тут лежит current</p>
<p style="margin:0px;text-indent:0px">/var/www/html - симлинк на на /var/www/stable или /var/www/current</p>
<p style="margin:0px;text-indent:0px"> </p>
<p style="margin:0px;text-indent:0px">В nginx пыха сконфигурирована как</p>
<p style="margin:0px;text-indent:0px"> </p>
<p style="margin:0px;text-indent:0px">root /var/www/html;</p>
<p style="margin:0px;text-indent:0px">                location / {</p>
<p style="margin:0px;text-indent:0px">                        fastcgi_pass unix:/run/php-fpm.socket;</p></div></blockquote><div><br></div><div>сделайте тут проксирование на апстрим (в котором перечислены несколько бекендов)<br>fastcgi_connect_timeout  сделайте минимальным<br></div><div><br> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="font-family:"Noto Sans";font-size:12pt;font-weight:400;font-style:normal">
<p style="margin:0px;text-indent:0px">                        include        fastcgi_params;</p>
<p style="margin:0px;text-indent:0px">                        fastcgi_param SCRIPT_FILENAME $document_root/index.php;</p>
<p style="margin:0px;text-indent:0px">                }</p>
<p style="margin:0px;text-indent:0px"> </p>
<p style="margin:0px;text-indent:0px">Проблема в том. что при переключение stable->current (и наоборот), </p></div></blockquote><div><br></div><div>достаточно будет запустить тот или иной бекенд <br><br></div><div>(не уверен, что с unix-сокетами получится, в крайнем случае можно на tcp проксировать)<br></div><div><br> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="font-family:"Noto Sans";font-size:12pt;font-weight:400;font-style:normal"><p style="margin:0px;text-indent:0px">которая происходит примерно так:</p>
<p style="margin:0px;text-indent:0px"># /var/www/html указывает на  /var/www/stable , переключаемся на current</p>
<p style="margin:0px;text-indent:0px">rm /var/www/html; ln -s /var/www/current/  /var/www/html</p>
<p style="margin:0px;text-indent:0px"> </p>
<p style="margin:0px;text-indent:0px">до упора используются файлы из старой директории (stable в примере выше). Не помогает ни очистка opcache, ни рестарт пыхи. Только restart (возможно reload, не уверен) nginx. </p>
<p style="margin:0px;text-indent:0px">Хотелось бы</p>
<p style="margin:0px;text-indent:0px">1) понять почему так. nginx где-то как-то кеширует куда указывает симлинк?</p>
<p style="margin:0px;text-indent:0px">2) избежать этого ("троганья" nginx (в идеале и рестарта php-fpm), в принципе готовы поменять воркфлоу, но пока не понимаем как.</p>
<p style="margin:0px;text-indent:0px"> </p>
<p style="margin:0px;text-indent:0px">С уважением, Иван.</p></div><br>______________________________<wbr>_________________<br>
nginx-ru mailing list<br>
<a href="mailto:nginx-ru@nginx.org">nginx-ru@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx-ru" rel="noreferrer" target="_blank">http://mailman.nginx.org/<wbr>mailman/listinfo/nginx-ru</a><br></blockquote></div><br></div></div>