在nginx编译安装完成后,nginx需要用www用户运行,且设置开启自启动,切换root用户,添加脚本如下:

#!/bin/sh

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

DESC="nginx daemon"
 NAME=nginx
 DAEMON=/usr/local/nginx/sbin/$NAME
 CONFIGFILE=/usr/local/nginx/conf/$NAME.conf
 PIDFILE=/usr/local/nginx/logs/$NAME.pid
 SCRIPTNAME=/etc/init.d/$NAME

set -e
 [ -x "$DAEMON" ] || exit 0

do_start() {
 $DAEMON -c $CONFIGFILE || echo -n "nginx already running"
 }

do_stop() {
 kill -INT `cat $PIDFILE` || echo -n "nginx not running"
 }

do_reload() {
 kill -HUP `cat $PIDFILE` || echo -n "nginx can't reload"
 }

case "$1" in
 start)
 echo -n "Starting $DESC: $NAME"
 do_start
 echo "."
 ;;
 stop)
 echo -n "Stopping $DESC: $NAME"
 do_stop
 echo "."
 ;;
 reload|graceful)
 echo -n "Reloading $DESC configuration..."
 do_reload
 echo "."
 ;;
 restart)
 echo -n "Restarting $DESC: $NAME"
 do_stop
 do_start
 echo "."
 ;;
 *)
 echo "Usage: $SCRIPTNAME {start|stop|reload|restart}" >&2
 exit 3
 ;;
 esac

exit 0

5 条评论

p666gamedownload · 2025-12-19 20:18

If you are looking for some nice gaming content, you should definitely check out p666gamedownload. A friend told me and I appreciate it lots. Check it out at p666gamedownload.

gbet777 · 2025-12-24 11:01

Gbet777, hmm, not bad, not bad. I won a little something last week. Just don’t get too addicted, okay? You can start playing at Gbet777 here: gbet777

jilivip · 2026-01-14 19:55

jilivip https://www.jilivipu.net

pesomaxfun · 2026-01-14 21:03

pesomaxfun https://www.elpesomaxfun.com

pin77 app · 2026-01-14 21:26

pin77 app https://www.pin77.tech

回复 jilivip 取消回复

Avatar placeholder

您的邮箱地址不会被公开。 必填项已用 * 标注