joozh 发表于 2018-11-13 09:51:42

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

更改掉nginx默认的用户和用户组  
cd /application/nginx/conf/
  
grep "user " nginx.conf
  
sed -i 's/#usernobody/usernginx nginx/g' nginx.conf
  
grep "user " nginx.conf
  
../sbin/nginx -t
  
../sbin/nginx -s reload
  
ps -ef |grep nginx
  
# cd /application/nginx/conf/
  
# grep "user " nginx.conf
  
#usernobody;
  
    #log_formatmain'$remote_addr - $remote_user [$time_local] "$request" '
  
# sed -i 's/#usernobody/usernginx nginx/g' nginx.conf
  
# grep "user " nginx.conf
  
usernginx nginx;
  
    #log_formatmain'$remote_addr - $remote_user [$time_local] "$request" '
  
###########
  
# ../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
  
# ../sbin/nginx -s reload
  
# ps -ef |grep nginx
  
nginx   152015190 09:06 ?      00:00:00 php-fpm: pool www
  
nginx   152115190 09:06 ?      00:00:00 php-fpm: pool www
  
nginx   152215190 09:06 ?      00:00:00 php-fpm: pool www
  
nginx   152315190 09:06 ?      00:00:00 php-fpm: pool www
  
nginx   152415190 09:06 ?      00:00:00 php-fpm: pool www
  
nginx   152515190 09:06 ?      00:00:00 php-fpm: pool www
  
nginx   152615190 09:06 ?      00:00:00 php-fpm: pool www
  
nginx   152715190 09:06 ?      00:00:00 php-fpm: pool www
  
nginx   152815190 09:06 ?      00:00:00 php-fpm: pool www
  
nginx   152915190 09:06 ?      00:00:00 php-fpm: pool www
  
nginx   153015190 09:06 ?      00:00:00 php-fpm: pool www
  
nginx   153115190 09:06 ?      00:00:00 php-fpm: pool www
  
nginx   153215190 09:06 ?      00:00:00 php-fpm: pool www
  
nginx   153315190 09:06 ?      00:00:00 php-fpm: pool www
  
nginx   153415190 09:06 ?      00:00:00 php-fpm: pool www
  
nginx   153515190 09:06 ?      00:00:00 php-fpm: pool www
  
root      8467   10 09:45 ?      00:00:00 nginx: master process /application/nginx-1.6.2/sbin/nginx
  
nginx   868684670 11:23 ?      00:00:00 nginx: worker process
  
root      869086260 11:23 pts/1    00:00:00 grep nginx
  
#####################################
  
方法二:在编译的时候指定用户和组
  
# /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
  
#


页: [1]
查看完整版本: 更改掉nginx默认的用户和用户组