Change the communication protocol between NginX and PHP-FPM

Unix domain socket seems to be much better than TPC for the communication protocol between NginX and PHP-FPM so I changed the config of them like this.
$ vi /etc/php-fpm-5.6.d/www.conf
; listen =
listen = /var/run/php-fpm/php-fpm-5.6.sock
listen.mode = 0660
$ vi /etc/nginx/conf.d/cookstar.conf
#            fastcgi_pass;
            fastcgi_pass   unix:/var/run/php-fpm/php-fpm-5.6.sock;

After changed the config of them, we need restart the processes. At the timing we restart PHP-FPM, php-fpm-5.6.sock is generated.
$ service php-fpm-5.6 restart
$ service nginx restart

Then I confirmed it communicates via Unix domain socket.
$ netstat -a --unix
unix  2      [ ACC ]     STREAM     LISTENING     1441769 /var/run/php-fpm/php-fpm-5.6.sock
If you liked this article

Let's subscribe the updates of Scuti!
Share on Google Plus

About Tomohide Kakeya

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment


Post a Comment