我已经将 nginx 设置为通过 unix 套接字而不是 tcp 连接到 php5-fpm。我读到过,这样做开销更小,因此可以提高性能。现在我想知道套接字的适当权限应该是什么,才能避免安全问题?
答案1
; Set permissions for unix socket, if one is used. In Linux, read/write
; permissions must be 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 0666
listen.owner = nginx ;(or the user that the Nginx is running as)
listen.group = nginx ;(or the group that the Nginx is running as)
listen.mode = 0660
答案2
对于 UNIX 套接字,执行权限并不重要,重要的是读写权限。因此,0660 表示将套接字限制为所有者用户/组,而 0666 表示允许任何人连接到它。