日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > php >内容正文

php

php fpm安装curl后,nginx出现connect() to unix:/var/run/php5-fpm.sock failed (13: Permission denied)的错误...

發(fā)布時間:2025/4/5 php 32 豆豆
生活随笔 收集整理的這篇文章主要介紹了 php fpm安装curl后,nginx出现connect() to unix:/var/run/php5-fpm.sock failed (13: Permission denied)的错误... 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

這里選擇直接apt-get安裝,因為比起自己編譯簡單多了,不需要自己配置什么

#sudo apt-get install curl libcurl3 libcurl3-dev php5-curl

安裝后重啟nginx

#nginx -s reload

豈知出現(xiàn)錯誤,php全部不能訪問,查看錯誤日志如下:

2014/07/24 23:59:46 [crit] 40455#0: *229072 connect() to unix:/var/run/php5-fpm.sock failed (13: Permission denied) while connecting to upstream, client: 171.9

處理方式是:編輯/etc/php5/fpm/pool.d/www.conf文件,將以下的注釋去掉:

listen.owner = www-data listen.group = www-data listen.mode = 0660

然后重啟php5-fpm

sudo service php5-fpm restart

即可。參考文章:

?

After doing an upgrade on my Debian virtual server, which upgraded PHP and Nginx, I got a "502 Bad Gateway" error when browsing websites on that server. This post shows how to fix this problem, and the configuration option to prevent it occurring again on reboot.?

tl;dr

Edit /etc/php5/fpm/pool.d/www.conf and uncomment the following:
? ? listen.owner = www-data
? ? listen.group = www-data
? ? listen.mode = 0660

Then run:
? ? sudo service php5-fpm restart

Longer answer

As well as the error in the browser, I was getting this error in the Nginx error log:?

[crit] 2686#0: *1 connect() to unix:/var/run/php5-fpm.sock failed (13: Permission denied) while connecting to upstream, client: 192.168.50.1, server: [...], request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "[...]"

The problem is caused by the permissions and ownership of the /var/run/php5-fpm.sock file, which after I'd done the upgrade change to something like root:root and 0660, so it couldn't be accessed by the www-data user which Nginx was running as.

The immediate solution is to change the permissions and/or ownership of the file like so:

chmod 0666 /var/run/php5-fpm.sock

OR

chmod 0660 /var/run/php5-fpm.sock chown www-data:www-data /var/run/php5-fpm.sock

The only catch is this won't persist after the server is restarted. To prevent the issue from occurring again, edit the?/etc/php5/fpm/pool.d/www.conf file:

sudo nano /etc/php5/fpm/pool.d/www.conf

Locate the following lines and uncomment them:

listen.owner = www-data listen.group = www-data listen.mode = 0660

If you already changed the ownership/permissions of the socket file as shown above, then you don't need to do anything else now. If you didn't, then run this:?

sudo service php5-fpm restart

This re-creates the socket file with the ownership and permissions as configured in the file.

總結

以上是生活随笔為你收集整理的php fpm安装curl后,nginx出现connect() to unix:/var/run/php5-fpm.sock failed (13: Permission denied)的错误...的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內容還不錯,歡迎將生活随笔推薦給好友。