nginx進程屬主問題討論

   文章做者:luxianghaohtml

   文章來源:http://www.cnblogs.com/luxianghao/p/6107096.html 轉載請註明,謝謝合做。nginx

   免責聲明:文章內容僅表明我的觀點,若有不當,歡迎指正。vim

   --- app

近來因爲工做需求,和nginx接觸較多,現把關於nginx進程屬主的問題總結以下:htm

規則
nginx啓動進程能夠在conf裏指定user(user  work;)可是這個只有在用root啓動的狀況有意義,
若是是用其餘用戶啓動的nginx master是沒有意義的 nginx會忽略這個配置,以下nginx warning所述
nginx: [warn] the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /home/work/app/nginx/conf/nginx.conf:1
 
結論
1,在非root帳戶下啓動時,nignx的master和worker進程的owner都將是這個帳戶,
2,在root帳戶下啓動時 nignx的master進程是的owner是root,worker的owner在conf已配置用戶的狀況下,owner是配置的用戶,不然將是nobody,並且也可能致使nginx的一些文件的owner也是nobody
 
# ps -ef | grep nginx
work     26620 21666  0 19:18 pts/5    00:00:00 vim conf/nginx.conf
root     26901     1  0 19:19 ?        00:00:00 nginx: master process ./sbin/nginx
nobody   26902 26901  0 19:19 ?        00:00:00 nginx: worker process
nobody   26903 26901  0 19:19 ?        00:00:00 nginx: worker process
nobody   26904 26901  0 19:19 ?        00:00:00 nginx: worker process
nobody   26905 26901  0 19:19 ?        00:00:00 nginx: worker process
nobody   26906 26901  0 19:19 ?        00:00:00 nginx: worker process
nobody   26910 26901  0 19:19 ?        00:00:00 nginx: cache manager process
nobody   26911 26901  0 19:19 ?        00:00:00 nginx: cache loader process
root     26918 24078  0 19:19 pts/11   00:00:00 grep nginx
 
# ll
total 72
drwxrwxr-x 7 work   work 4096 Jul 15 11:55 _book
drwxr-xr-x 2 nobody work 4096 Jul 15 11:55 cache
drwx------ 2 nobody work 4096 Jul 15 11:55 client_body_temp
drwxrwxr-x 2 work   work 4096 Nov 27 19:18 conf
drwx------ 2 nobody work 4096 Jul 15 11:55 fastcgi_temp
drwxrwxr-x 2 work   work 4096 Jul 15 11:55 html
drwx------ 2 nobody work 4096 Jul 15 11:55 uwsgi_temp
相關文章
相關標籤/搜索