您的位置:首页 > 运维架构 > Nginx

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

2015-09-24 11:27 627 查看
更改掉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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: