首页 > 其他 > 详细

更改掉nginx默认的用户和用户组

时间:2015-09-24 19:43:02      阅读:361      评论:0      收藏:0      [点我收藏+]

更改掉nginx默认的用户和用户组

cd /application/nginx/conf/

grep "user " nginx.conf

sed -i ‘s/#user  nobody/user  nginx nginx/g‘ nginx.conf

grep "user " nginx.conf

../sbin/nginx -t

../sbin/nginx -s reload

ps -ef |grep nginx


[root@LNMP conf]# cd /application/nginx/conf/                                           

[root@LNMP conf]# grep "user " nginx.conf           

#user  nobody;

    #log_format  main  ‘$remote_addr - $remote_user [$time_local] "$request" ‘

[root@LNMP conf]# sed -i ‘s/#user  nobody/user  nginx nginx/g‘ nginx.conf                 

[root@LNMP conf]# grep "user " nginx.conf                                

user  nginx nginx;

    #log_format  main  ‘$remote_addr - $remote_user [$time_local] "$request" ‘

###########


[root@LNMP conf]# ../sbin/nginx -t

nginx: the configuration file /application/nginx-1.6.2/conf/nginx.conf syntax is ok

nginx: configuration file /application/nginx-1.6.2/conf/nginx.conf test is successful

[root@LNMP conf]# ../sbin/nginx -s reload

[root@LNMP conf]# ps -ef |grep nginx

nginx     1520  1519  0 09:06 ?        00:00:00 php-fpm: pool www            

nginx     1521  1519  0 09:06 ?        00:00:00 php-fpm: pool www            

nginx     1522  1519  0 09:06 ?        00:00:00 php-fpm: pool www            

nginx     1523  1519  0 09:06 ?        00:00:00 php-fpm: pool www            

nginx     1524  1519  0 09:06 ?        00:00:00 php-fpm: pool www            

nginx     1525  1519  0 09:06 ?        00:00:00 php-fpm: pool www            

nginx     1526  1519  0 09:06 ?        00:00:00 php-fpm: pool www            

nginx     1527  1519  0 09:06 ?        00:00:00 php-fpm: pool www            

nginx     1528  1519  0 09:06 ?        00:00:00 php-fpm: pool www            

nginx     1529  1519  0 09:06 ?        00:00:00 php-fpm: pool www            

nginx     1530  1519  0 09:06 ?        00:00:00 php-fpm: pool www            

nginx     1531  1519  0 09:06 ?        00:00:00 php-fpm: pool www            

nginx     1532  1519  0 09:06 ?        00:00:00 php-fpm: pool www            

nginx     1533  1519  0 09:06 ?        00:00:00 php-fpm: pool www            

nginx     1534  1519  0 09:06 ?        00:00:00 php-fpm: pool www            

nginx     1535  1519  0 09:06 ?        00:00:00 php-fpm: pool www            

root      8467     1  0 09:45 ?        00:00:00 nginx: master process /application/nginx-1.6.2/sbin/nginx

nginx     8686  8467  0 11:23 ?        00:00:00 nginx: worker process              

root      8690  8626  0 11:23 pts/1    00:00:00 grep nginx



#####################################

方法二:在编译的时候指定用户和组

[root@LNMP conf]# /application/nginx/sbin/nginx -V

nginx version: lvnian/2.2.22

built by gcc 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC) 

TLS SNI support enabled

configure arguments: --user=nginx --group=nginx --prefix=/application/nginx-1.6.2 --with-http_stub_status_module --with-http_ssl_module

[root@LNMP conf]# 


本文出自 “技术改变命运” 博客,请务必保留此出处http://lvnian.blog.51cto.com/7155281/1697759

更改掉nginx默认的用户和用户组

原文:http://lvnian.blog.51cto.com/7155281/1697759

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!