Nginx Connection php-fpm sock file failed 502

Source: Internet
Author: User

Today, the VPS on the php5.3 upgrade to the php5.4, I use the NGINX+PHP-FPM architecture, nginx through the PHP-FPM socks file to connect.
Result Error:
Connect () to Unix:/tmp/php-cgi.sock failed (13:permission denied) while connecting to upstream

I checked./tmp/php-cgi.sock found that the file owner is root, and nginx and php-fpm are WWW users to run, supposedly, this sock file should also be www.

It was later found that there was a configuration in php-fpm.conf:
; Set Permissions for UNIX sockets, if one is used. In Linux, Read/write
; Permissions must is set in order to allow connections from a Web server. Many
; Bsd-derived systems allow connections regardless of permissions.
; Default Values:user and group are set as the running user
; Mode is set to 0660
; listen.owner = www
; listen.group = www
; Listen.mode = 0660

Strangely, by default, you should use the user and group configuration items to set permissions, but not in fact. Anyway, it solves the problem by manually specifying the configuration here.
; Set Permissions for UNIX sockets, if one is used. In Linux, Read/write
; Permissions must is set in order to allow connections from a Web server. Many
; Bsd-derived systems allow connections regardless of permissions.
; Default Values:user and group are set as the running user
; Mode is set to 0660
Listen.owner = www
Listen.group = www
; Listen.mode = 0660

Nginx Connection php-fpm sock file failed 502

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.