nginx 與 php-fpm socket 所有者權限問題
怪我咯
怪我咯 2017-05-16 17:26:02
0
3
780

配置完 ngix php-fpmnginx 錯誤:

2014/12/08 12:19:19 [crit] 27575#0: *4 connect() to unix:/var/run/php-fpm/vbox.dev.sock failed (13: Permission denied) while connecting to upstream, client: 192.168.56.101, server: vbox.dev, request: "GET /index.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm/vbox.dev.sock:", host: "vbox.dev"

相關配置如下:

php-fpm

[vbox.dev]

user = nginx
group = nginx

listen = /var/run/php-fpm/vbox.dev.sock

listen.owner = nginx
listen.group = nginx
listen.mode = 0660

pm = dynamic
pm.max_children = 75
pm.start_servers = 10
pm.min_spare_servers = 5
pm.max_spare_servers = 20
pm.max_requests = 500

env[HOSTNAME] = $HOSTNAME
env[PATH] = /usr/local/bin:/usr/bin:/bin
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp

檔案權限:

ls -al /var/run/php-fpm/vbox.dev.sock 
srw-rw----. 1 nginx nginx 0 Dec  8 12:19 /var/run/php-fpm/vbox.dev.sock

ps -ef | grep nginx:
root     27573     1  0 12:17 ?        00:00:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
nginx    27575 27573  0 12:17 ?        00:00:00 nginx: worker process

ps -ef | grep php-fpm
root     27587     1  0 12:19 ?        00:00:00 php-fpm: master process (/etc/php-fpm.conf)                                                  
nginx    27588 27587  0 12:19 ?        00:00:00 php-fpm: pool vbox.dev                                                                       
nginx    27589 27587  0 12:19 ?        00:00:00 php-fpm: pool vbox.dev                                                                       
nginx    27590 27587  0 12:19 ?        00:00:00 php-fpm: pool vbox.dev                                                                       
nginx    27591 27587  0 12:19 ?        00:00:00 php-fpm: pool vbox.dev                                                                       
nginx    27592 27587  0 12:19 ?        00:00:00 php-fpm: pool vbox.dev                                                                       
nginx    27593 27587  0 12:19 ?        00:00:00 php-fpm: pool vbox.dev                                                                       
nginx    27594 27587  0 12:19 ?        00:00:00 php-fpm: pool vbox.dev                                                                       
nginx    27595 27587  0 12:19 ?        00:00:00 php-fpm: pool vbox.dev                                                                       
nginx    27596 27587  0 12:19 ?        00:00:00 php-fpm: pool vbox.dev                                                                       
nginx    27597 27587  0 12:19 ?        00:00:00 php-fpm: pool vbox.dev                                                                       
www-data 27598 27587  0 12:19 ?        00:00:00 php-fpm: pool global-pool

求指點!

怪我咯
怪我咯

走同样的路,发现不同的人生

全部回覆(3)
Peter_Zhu

listen.owner = nginx
listen.group = nginx
listen.mode = 0660

以上 listen.owner listen.group 可不設定
listen.mode = 0666

另外建議sock檔案放在/dev/shm目錄下
此目錄下將sock檔案放在記憶體裡面,有助於效能提升

淡淡烟草味

Permission denied ...

在沒有權限呀!

在root下執行。

Peter_Zhu

你問題解決了麼?沒解決的話能讓我看下你/var/run/php-fpm這個目錄的權限麼

熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板