0

Почему-то не стартует apache2

Job for apache2.service failed because the control process exited with error code.
See "systemctl status apache2.service" and "journalctl -xe" for details.

Помогите пожалуйста разобраться почему не стартует apache2, я уже его пробовал переустановить, так же nginx отключен 80 порт свободен.

cat /usr/sbin/apachectl

#!/bin/sh
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# Apache control script designed to allow an easy command line interface
# to controlling Apache.  Written by Marc Slemko, 1997/08/23
#
# Heavily modified for Debian by Stefan Fritsch 2007-2010
#
# The exit codes returned are:
#   XXX this doc is no longer correct now that the interesting
#   XXX functions are handled by httpd
#       0 - operation completed successfully
#       1 -
#       2 - usage error
#       3 - httpd could not be started
#       4 - httpd could not be stopped
#       5 - httpd could not be started during a restart
#       6 - httpd could not be restarted during a restart
#       7 - httpd could not be restarted during a graceful restart
#       8 - configuration syntax error
#
# When multiple arguments are given, only the error from the _last_
# one is reported.  Run "apachectl help" for usage info
#
ARGV="$@"
#
# |||||||||||||||||||| START CONFIGURATION SECTION  ||||||||||||||||||||
# --------------------                              --------------------
#
# main configuration directory
if test -z "$APACHE_CONFDIR" ; then
        if test "${0##*apache2ctl-}" != "$0" ; then
                APACHE_CONFDIR="/etc/apache2-${0##*apache2ctl-}"
        else
                APACHE_CONFDIR=/etc/apache2
        fi
fi

SUFFIX="${APACHE_CONFDIR##/etc/apache2-}"
case "$SUFFIX" in
        /etc/apache2)
                SUFFIX=""
                ;;
        *)
                SUFFIX="@$SUFFIX"
                ;;
esac
APACHE_SYSTEMD_SERVICE="apache2$SUFFIX"

# the path to the environment variable file
test -z "$APACHE_ENVVARS" && APACHE_ENVVARS="$APACHE_CONFDIR/envvars"
# pick up any necessary environment variables
if test -f $APACHE_ENVVARS; then
  . $APACHE_ENVVARS
fi

if test "$APACHE_CONFDIR" != /etc/apache2 ; then
        APACHE_ARGUMENTS="-d $APACHE_CONFDIR $APACHE_ARGUMENTS"
fi
# the following APACHE_* variables should be set in /etc/apache2/envvars
#
# the path to your httpd binary, including options if necessary
HTTPD=${APACHE_HTTPD:-/usr/sbin/apache2}
#
# a command that outputs a formatted text version of the HTML at the
# url given on the command line.  Designed for lynx, however other
# programs may work.
LYNX="${APACHE_LYNX:-www-browser -dump}"
#
# the URL to your server's mod_status status page.  If you do not
# have one, then status and fullstatus will not work.
STATUSURL="${APACHE_STATUSURL:-http://localhost:80/server-status}"
#
# Set this variable to a command that increases the maximum
# number of file descriptors allowed per child process. This is
# critical for configurations that use many file descriptors,
# such as mass vhosting, or a multithreaded server.
ULIMIT_MAX_FILES="${APACHE_ULIMIT_MAX_FILES:-ulimit -n 8192}"
# --------------------                              --------------------
# ||||||||||||||||||||   END CONFIGURATION SECTION  ||||||||||||||||||||

# Set the maximum number of file descriptors allowed per child process.
if [ "x$ULIMIT_MAX_FILES" != "x" ] && [ `id -u` -eq 0 ] ; then
    if ! $ULIMIT_MAX_FILES ; then
        echo Setting ulimit failed. See README.Debian for more information. >&2
    fi
fi

ERROR=0
if [ "x$ARGV" = "x" ] || [ "x$ARGV" = "xusage" ] || [ "x$ARGV" = "xhelp" ] || [ "x$ARGV" = "x--help" ]; then
    echo "Usage: $0 start|stop|restart|graceful|graceful-stop|configtest|status|fullstatus|help" >&2
    echo "       $0 <apache2 args>" >&2
    echo "       $0 -h            (for help on <apache2 args>)" >&2
    exit 1
fi

get_status () {
    if ! $LYNX $STATUSURL ; then
        echo "'$LYNX $STATUSURL'" failed. >&2
        echo Maybe you need to install a package providing www-browser or you >&2
        echo need to adjust the APACHE_LYNX variable in /etc/apache2/envvars >&2
        exit 1
    fi
}

mkdir_chown () {
    local OWNER="$1"
    local DIR="$2"
    local STAT="$(LC_ALL=C stat -c %F:%U $DIR 2> /dev/null || true)"
    if [ "$STAT" = "" ] ; then
        local TMPNAME=$(mktemp -d $DIR.XXXXXXXXXX) || exit 1
        chmod 755 $TMPNAME || exit 1
        chown $OWNER $TMPNAME || exit 1
        if ! mv -T $TMPNAME $DIR 2> /dev/null; then
            rmdir $TMPNAME
            # check for race with other apachectl
            if [ "$(LC_ALL=C stat -c %F:%U $DIR 2>/dev/null)" != "directory:$OWNER" ]
            then
                echo Cannot create $DIR with owner $OWNER.
                echo Please fix manually. Aborting.
                exit 1
            fi
        fi
    elif [ "$STAT" != "directory:$OWNER" ] ; then
        echo $DIR already exists but is not a directory owned by $OWNER.
        echo Please fix manually. Aborting.
        exit 1
    fi
}


[ ! -d ${APACHE_RUN_DIR:-/var/run/apache2} ] && mkdir -p ${APACHE_RUN_DIR:-/var/run/apache2}
[ ! -d ${APACHE_LOCK_DIR:-/var/lock/apache2} ] && mkdir_chown ${APACHE_RUN_USER:-www-data} ${APACHE_LOCK_DIR:-/var/lock/apache2}

case "$ARGV" in
start)
    # ssl_scache shouldn't be here if we're just starting up.
    # (this is bad if there are several apache2 instances running)
    rm -f ${APACHE_RUN_DIR:-/var/run/apache2}/*ssl_scache*

    need_systemd=false
    if [ -z "$APACHE_STARTED_BY_SYSTEMD" ] ; then
        case "$(readlink -f /proc/1/exe)" in
        *systemd*)
            need_systemd=true
            ;;
        *)
            ;;
        esac
    fi
    if $need_systemd ; then
        # If running on systemd we should not start httpd without systemd
        # or systemd will get confused about the status of httpd.
        echo "Invoking 'systemctl start $APACHE_SYSTEMD_SERVICE'."
        echo "Use 'systemctl status $APACHE_SYSTEMD_SERVICE' for more info."
        systemctl start "$APACHE_SYSTEMD_SERVICE"
    else
        unset APACHE_STARTED_BY_SYSTEMD
        $HTTPD ${APACHE_ARGUMENTS} -k "$ARGV"
    fi

    ERROR=$?
    ;;
stop|graceful-stop)
    $HTTPD ${APACHE_ARGUMENTS} -k "$ARGV"
    ERROR=$?
    ;;
restart|graceful)
    if $HTTPD ${APACHE_ARGUMENTS} -t 2> /dev/null ; then
        $HTTPD ${APACHE_ARGUMENTS} -k "$ARGV"
    else
        $HTTPD ${APACHE_ARGUMENTS} -t
    fi
    ERROR=$?
    ;;
startssl|sslstart|start-SSL)
    echo The startssl option is no longer supported.
    echo Please edit httpd.conf to include the SSL configuration settings
    echo and then use "apachectl start".
    ERROR=2
    ;;
configtest)
    $HTTPD ${APACHE_ARGUMENTS} -t
    ERROR=$?
    ;;
status)
    get_status | awk ' /process$/ { print; exit } { print } '
    ;;
fullstatus)
    get_status
    ;;
*)
    $HTTPD ${APACHE_ARGUMENTS} "$@"
    ERROR=$?
esac

if [ "$ERROR" != 0 ] ; then
        echo Action \'"$@"\' failed.
        echo The Apache error log may have more information.
fi
exit $ERROR

++++++++++++++ journalctl -xa | grep -i apache

    Jun 29 23:49:02 00.00.000.00 apachectl[6098]: /usr/sbin/apachectl: 174: /usr/sbin/apachectl: /usr/sbin/apache2: not found
Jun 29 23:49:02 00.00.000.00 apachectl[6098]: Action 'start' failed.
Jun 29 23:49:02 00.00.000.00 apachectl[6098]: The Apache error log may have more information.
Jun 29 23:49:02 00.00.000.00 systemd[1]: apache2.service: Control process exited, code=exited status=127
Jun 29 23:49:02 00.00.000.00 systemd[1]: apache2.service: Failed with result 'exit-code'.
Jun 29 23:49:02 00.00.000.00 systemd[1]: Failed to start The Apache HTTP Server.
-- Subject: Unit apache2.service has failed
-- Unit apache2.service has failed.
Jun 30 00:07:05 00.00.000.00 sudo[8873]:    pavel : TTY=pts/0 ; PWD=/etc/apache2 ; USER=root ; COMMAND=/bin/systemctl restart apache2
Jun 30 00:07:05 00.00.000.00 systemd[1]: Starting The Apache HTTP Server...
-- Subject: Unit apache2.service has begun start-up
-- Unit apache2.service has begun starting up.
Jun 30 00:07:05 00.00.000.00 apachectl[8876]: /usr/sbin/apachectl: 174: /usr/sbin/apachectl: /usr/sbin/apache2: not found
Jun 30 00:07:05 00.00.000.00 apachectl[8876]: Action 'start' failed.
Jun 30 00:07:05 00.00.000.00 apachectl[8876]: The Apache error log may have more information.
Jun 30 00:07:05 00.00.000.00 systemd[1]: apache2.service: Control process exited, code=exited status=127
Jun 30 00:07:05 00.00.000.00 systemd[1]: apache2.service: Failed with result 'exit-code'.
Jun 30 00:07:05 00.00.000.00 systemd[1]: Failed to start The Apache HTTP Server.
-- Subject: Unit apache2.service has failed
-- Unit apache2.service has failed.
Jun 30 03:47:09 00.00.000.00 sshd[28766]: Invalid user apache2 from 51.75.18.215 port 59540
Jun 30 03:47:11 00.00.000.00 sshd[28766]: Failed password for invalid user apache2 from 51.75.18.215 port 59540 ssh2
Jun 30 04:16:06 00.00.000.00 sshd[32043]: Invalid user apacher from 119.28.238.101 port 49456
Jun 30 04:16:07 00.00.000.00 sshd[32043]: Failed password for invalid user apacher from 119.28.238.101 port 49456 ssh2
Jun 30 08:59:07 00.00.000.00 sudo[4520]:    pavel : TTY=pts/0 ; PWD=/home/pavel ; USER=root ; COMMAND=/usr/sbin/service apache2 start
Jun 30 08:59:07 00.00.000.00 systemd[1]: Starting The Apache HTTP Server...
-- Subject: Unit apache2.service has begun start-up
-- Unit apache2.service has begun starting up.
Jun 30 08:59:07 00.00.000.00 apachectl[4544]: /usr/sbin/apachectl: 174: /usr/sbin/apachectl: /usr/sbin/apache2: not found
Jun 30 08:59:07 00.00.000.00 apachectl[4544]: Action 'start' failed.
Jun 30 08:59:07 00.00.000.00 apachectl[4544]: The Apache error log may have more information.
Jun 30 08:59:07 00.00.000.00 systemd[1]: apache2.service: Control process exited, code=exited status=127
Jun 30 08:59:07 00.00.000.00 systemd[1]: apache2.service: Failed with result 'exit-code'.
Jun 30 08:59:07 00.00.000.00 systemd[1]: Failed to start The Apache HTTP Server.
-- Subject: Unit apache2.service has failed
-- Unit apache2.service has failed.
Jun 30 13:55:17 00.00.000.00 sudo[21344]:    pavel : TTY=pts/0 ; PWD=/etc/nginx/conf.d ; USER=root ; COMMAND=/usr/sbin/service apache2 start
Jun 30 13:55:17 00.00.000.00 systemd[1]: Starting The Apache HTTP Server...
-- Subject: Unit apache2.service has begun start-up
-- Unit apache2.service has begun starting up.
Jun 30 13:55:17 00.00.000.00 apachectl[21368]: /usr/sbin/apachectl: 174: /usr/sbin/apachectl: /usr/sbin/apache2: not found
Jun 30 13:55:17 00.00.000.00 apachectl[21368]: Action 'start' failed.
Jun 30 13:55:17 00.00.000.00 apachectl[21368]: The Apache error log may have more information.
Jun 30 13:55:17 00.00.000.00 systemd[1]: apache2.service: Control process exited, code=exited status=127
Jun 30 13:55:17 00.00.000.00 systemd[1]: apache2.service: Failed with result 'exit-code'.
Jun 30 13:55:17 00.00.000.00 systemd[1]: Failed to start The Apache HTTP Server.
-- Subject: Unit apache2.service has failed
-- Unit apache2.service has failed.
4
  • приложите к вопросу вывод $ ls -l /usr/sbin/apachectl; file /usr/sbin/apachectl 29 июн 2020 в 23:26
  • Приложил содержимое файла /usr/sbin/apachectl
    – Pavel
    30 июн 2020 в 6:04
  • journalctl -xa | grep -i apache? 30 июн 2020 в 10:38
  • Добавил последние записи по apache2
    – Pavel
    30 июн 2020 в 11:06

1 ответ 1

0

Написано же вполне ясно:

/usr/sbin/apache2: not found
  1. Его там нет. А может и есть, но без прав рута недоступен. Выполните "ls /usr/sbin/"
  2. Узнать, где он на самом деле можно, выполнив команду "whereis apache2"
  3. Почему Вы считаете, что он должен быть в папке "/usr/sbin/" ?! Она для других программ.
  4. Как вы его так устанавливали, что он оказался в 'sbin" ?!
2
  • 1. apache2ctl и apachectl 2. apache2: /etc/apache2 /usr/share/apache2 3. Я так не считаю, он был установлен вместе с панелью vestacp, возможно разработчики так посчитали, но я апаче сносил и переустанавливал. 4. Установил apt-get install apache2
    – Pavel
    1 июл 2020 в 6:24
  • @Pavel "1. apache2ctl и apachectl" - ну так чего же Вы хотите ?! Если программы нет - как же её можно запустить?! Я не знаю, что Вы устанавливали и как, но apache2 у Вас точно не установлен. Рекомендую снести всё, что Вы установили провести установку аккуратно, по инструкции.
    – Sergey
    2 июл 2020 в 3:15

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.