service nginx start|stop|restart 等等, 启动会这个错。
Job for nginx.service failed because a configured resource limit was exceeded. See "systemctl status nginx.service" and "journalctl -xe" for details.
[FAIL
[root@localhost showdoc]# systemctl status nginx.service
● nginx.service - SYSV: Nginx is an HTTP(S) server, HTTP(S) reverse proxy and IMAP/POP3 proxy server
Loaded: loaded (/etc/rc.d/init.d/nginx)
Active: failed (Result: resources) since Wed 2016-11-23 11:04:24 CST; 19min ago
Docs: man:systemd-sysv-generator(8)
Process: 6852 ExecStart=/etc/rc.d/init.d/nginx start (code=exited, status=0/SUCCESS)
Nov 23 11:04:24 localhost.localdomain systemd[1]: Starting SYSV: Nginx is an HTTP(S) server, HTTP(S) reverse proxy and IMAP/POP3 proxy server...
Nov 23 11:04:24 localhost.localdomain systemd[1]: PID file /var/run/nginx.pid not readable (yet?) after start.
Nov 23 11:04:24 localhost.localdomain systemd[1]: Failed to start SYSV: Nginx is an HTTP(S) server, HTTP(S) reverse proxy and IMAP/POP3 proxy server.
Nov 23 11:04:24 localhost.localdomain systemd[1]: Unit nginx.service entered failed state.
Nov 23 11:04:24 localhost.localdomain systemd[1]: nginx.service failed
nginx的配置是没问题的。
Nov 23 11:04:24 localhost.localdomain systemd[1]: nginx.service failed.
[root@localhost showdoc]# /usr/local/nginx/sbin/nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
详细看 systemctl status nginx.service 的问题。 检查了都没问题。 至今无解。
9 Answers
启动脚本有坑,nginx reload 和stop的时候是直接用killproc 干掉进程的,应该用nginx -s reload 和nginx -s stop 完整脚本如下。
#!/bin/sh
#
# nginx - this script starts and stops the nginx daemin
#
# chkconfig: - 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /www/wdlinux/nginx/conf/nginx.conf
# pidfile: /www/wdlinux/nginx/logs/nginx.pid
# Url http://www.wdlinux.cn
# Last Updated 2010.06.01
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ "$NETWORKING" = "no" ] && exit 0
nginx="/usr/local/tengine/sbin/nginx"
prog=$(basename $nginx)
NGINX_CONF_FILE="/usr/local/tengine/conf/nginx.conf"
#NGINX_PID="/www/wdlinux/nginx/logs/nginx.pid"
[ -f /etc/sysconfig/nginx ] && . /etc/sysconfig/nginx
lockfile=/var/lock/subsys/nginx
start() {
[ -x $nginx ] || exit 5
[ -f $NGINX_CONF_FILE ] || exit 6
echo -n $"Starting $prog: "
daemon $nginx -c $NGINX_CONF_FILE
retval=$?
echo
##service php-fpm start
[ $retval -eq 0 ] && touch $lockfile
return $retval
}
stop() {
echo -n $"Stopping $prog: "
$nginx -s stop
echo_success
retval=$?
echo
##service php-fpm stop
[ $retval -eq 0 ] && rm -f $lockfile
return $retval
}
restart() {
stop
start
}
reload() {
configtest || return $?
echo -n $"Reloading $prog: "
$nginx -s reload
RETVAL=$?
echo
}
force_reload() {
restart
}
configtest() {
$nginx -t -c $NGINX_CONF_FILE
}
rh_status() {
status $prog
}
rh_status_q() {
rh_status >/dev/null 2>&1
}
case "$1" in
start)
rh_status_q && exit 0
$1
;;
stop)
rh_status_q || exit 0
$1
;;
restart|configtest)
$1
;;
reload)
rh_status_q || exit 7
$1
;;
force-reload)
force_reload
;;
status)
rh_status
;;
condrestart|try-restart)
rh_status_q || exit 0
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}"
exit 2
esac
Please login or Register to submit your answer