本文共 2861 字,大约阅读时间需要 9 分钟。
更改掉nginx默认的用户和用户组cd /application/nginx/conf/grep "user " nginx.confsed -i 's/#user nobody/user nginx nginx/g' nginx.confgrep "user " nginx.conf../sbin/nginx -t../sbin/nginx -s reloadps -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 -tnginx: the configuration file /application/nginx-1.6.2/conf/nginx.conf syntax is oknginx: 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 nginxnginx 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/nginxnginx 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 -Vnginx version: lvnian/2.2.22built by gcc 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC) TLS SNI support enabledconfigure arguments: --user=nginx --group=nginx --prefix=/application/nginx-1.6.2 --with-http_stub_status_module --with-http_ssl_module[root@LNMP conf]#
转载于:https://blog.51cto.com/lvnian/1697759