本文給大家介紹的關(guān)于php/167908.html">phpcms/33530.html">php + nginx項目權(quán)限的相關(guān)內(nèi)容,分享出來供大家參考學(xué)習(xí),下面來看看詳細的介紹:
nginx/php-fpm
進程權(quán)限
1、nginx的用戶為nginx.conf中配置的用戶
2、php-fpm的用戶為php-fpm.conf中配置的用戶
如:啟動nginx的是root,nginx中配置的user是nginx,那主進程就是root,子進程就是nginx
處理方式
以下訪問均以nginx子進程進行
靜態(tài)文件
php腳本文件
步驟:
權(quán)限情況:
用戶配置位置
nginx用戶設(shè)置在nginx.conf中第一行的user
php-fpm用戶設(shè)置在php-fpm.conf中的
注:以上兩個配置文件不同的操作系統(tǒng)下文件名略有不同,請根據(jù)自身安裝情況自行判斷。
nginx轉(zhuǎn)發(fā)內(nèi)容到php-fpm不只有/var/run/php5-fpm.sock的方式,在php-fpm.conf中還可以通過配置改為xxx.xxx.xxx:9000等方式
; The address on which to accept FastCGI requests.; Valid syntaxes are:; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific IPv4 address on; a specific port;; '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on; a specific port;; 'port' - to listen on a TCP socket to all IPv4 addresses on a; specific port;; '[::]:port' - to listen on a TCP socket to all addresses; (IPv6 and IPv4-mapped) on a specific port;; '/path/to/unix/socket' - to listen on a unix socket.; Note: This value is mandatory.listen = /var/run/php5-fpm.sock
其他
比較特別的點,一般nginx都是用root用戶啟動的(為了獲取80端口權(quán)限),如果本地開發(fā)nginx是用普通用戶重啟,那么主進程和子進程都會是當前用戶,nginx.conf中的配置不再起效,暫不清楚原因。
總結(jié)
以上就是這篇文章的全部內(nèi)容了,希望本文的內(nèi)容對大家的學(xué)習(xí)或者工作能帶來一定的幫助,如果有疑問大家可以留言交流,謝謝大家對VeVb武林網(wǎng)的支持。
新聞熱點
疑難解答
圖片精選