Skip to content

emka.web.id

Menu
  • Home
  • Indeks Artikel
  • Tutorial
  • Tentang Kami
Menu

How to make PHP-FPM to use a Unix Socket

Posted on March 18, 2013 by Syauqi Wiryahasana
By default PHP-FPM is listening on port 9000 on 127.0.0.1. It is also possible to make PHP-FPM use a Unix socket which avoids the TCP overhead. To do this, open /etc/php-fpm.d/www.conf... vi /etc/php-fpm.d/www.conf and make the listen line look as follows:
[...]
;listen = 127.0.0.1:9000
listen = /tmp/php5-fpm.sock
[...]
restart PHP-FPM  with /etc/init.d/php-fpm restart Next go through your nginx configuration and all your vhosts and change the line fastcgi_pass 127.0.0.1:9000; to fastcgi_pass unix:/tmp/php5-fpm.sock;, e.g. like this:
[...]
        location ~ \.php$ {
            root           /usr/share/nginx/html;
            fastcgi_pass   unix:/tmp/php5-fpm.sock;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }
[...]
Finally restart nginx: /etc/init.d/nginx restart
Seedbacklink

Recent Posts

TENTANG EMKA.WEB>ID

EMKA.WEB.ID adalah blog seputar teknologi informasi, edukasi dan ke-NU-an yang hadir sejak tahun 2011. Kontak: kontak@emka.web.id.

©2024 emka.web.id Proudly powered by wpStatically