PHP Setup Socket connection

Source: Internet
Author: User
Tags unix domain socket

Abstract: Author Bowen address: https://www.cnblogs.com/liu-shuai/

There are two ways of communication between Nginx and FastCGI, one is TCP, and the other is UNIX socket mode.

The socket does not go to the TCP layer, and the TCP approach goes to the IP layer. Therefore, in theory, the socket connection method is more efficient.

TCP and UNIX domain socket methods comparison
TCP is connected using TCP ports 127.0.0.1:9000
Socket is socket connection using UNIX domain socket/dev/shm/php-fpm.sock

1, modify the php-fpm.conf

1 127.0. 0.1:9000     # Note 2 listen =/dev/shm/php-fpm.sock     #/dev/shm/ is a memory file system, Guaranteed to read and write 3 listen.owner = nginx4 listen.group = nginx56 Service PHP-FPM Restart


2, modify the nginx.conf

1 #fastcgi_pass     127.0.  0.1:9000; 2 fastcgi_pass    unix:/dev/shm/php-fpm.sock; 3 4 /usr/local/nginx/sbin/nginx-s Reload




PHP Setup Socket connection

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.