Что делать, если не запускается апач?
Апач перестал запускаться, в логе что то про конфиг test, но его нету!
лог:
root@192:~# journalctl -xn
-- Logs begin at Пн 2017-06-26 23:05:02 MSK, end at Пн 2017-06-26 23:11:05 MSK. --
июн 26 23:11:05 192.168.0 systemd[1]: Starting LSB: Apache2 web server...
-- Subject: Начинается запуск юнита apache2.service
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Начат процесс запуска юнита apache2.service.
июн 26 23:11:05 192.168.0 apache2[2247]: Starting web server: apache2 failed!
июн 26 23:11:05 192.168.0 apache2[2247]: The apache2 configtest failed. ... (warning).
июн 26 23:11:05 192.168.0 apache2[2247]: Output of config test was:
июн 26 23:11:05 192.168.0 apache2[2247]: AH00534: apache2: Configuration error: No MPM loaded.
июн 26 23:11:05 192.168.0 apache2[2247]: Action 'configtest' failed.
июн 26 23:11:05 192.168.0 apache2[2247]: The Apache error log may have more information.
июн 26 23:11:05 192.168.0 systemd[1]: apache2.service: control process exited, code=exited status=1
июн 26 23:11:05 192.168.0 systemd[1]: Failed to start LSB: Apache2 web server.
-- Subject: Ошибка юнита apache2.service
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Произошел сбой юнита apache2.service.
--
-- Результат: failed.
июн 26 23:11:05 192.168.0 systemd[1]: Unit apache2.service entered failed state.
-
Вопрос заданболее трёх лет назад
-
4321 просмотр
Где-то в конфигурации апача ошибка.
Просмотрите errorlog — там может быть больше информации, например в какой строке.
У вас конкретно ошибка с MPM модулем — или для него недостаточно параметров, или вы апгрейдили апач, и конфиг остался от старого, в котором опции могут идти в некорректном порядке (например блоки virtualhost до блоков с погрузкой модулей)
Проверьте конфигурацию файлов, можно еще погуглить. Если все плохо — выложите конфиги сюда, тогда можно будет подсказать конкретнее. Потому что вариантов, что вызвало ошибку может быть много.
Пригласить эксперта
apt-get purge apache2 && apt-get install nginx -y
AH00534: apache2: Configuration error: No MPM loaded.
The Apache error log may have more information.
Action 'configtest' failed.
Говорит о том, что провален тест корректности конфигурации. Если Вы выполните в консоли команду configtest, то она скажет Вам где в ваших конфигах ошибка.
-
Показать ещё
Загружается…
29 янв. 2023, в 03:07
300000 руб./за проект
29 янв. 2023, в 02:16
700000 руб./за проект
29 янв. 2023, в 01:54
5000 руб./за проект
Минуточку внимания
0
1
Всем привет! Изучаю на виртуалке связку Apache 2 + Nginx. При попытке стартануть Апач, он пишет Произошёл сбой юнита apache2.serviceВ логах это
-- Logs begin at Пн 2015-11-09 18:37:54 YAKT, end at Пн 2015-11-09 19:02:14 YAKT. --
ноя 09 19:01:14 web systemd[1]: apache2.service: control process exited, code=exited status=1
ноя 09 19:01:14 web systemd[1]: Failed to start LSB: Apache2 web server.
-- Subject: Ошибка юнита apache2.service
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Произошел сбой юнита apache2.service.
--
-- Результат: failed.
ноя 09 19:01:14 web systemd[1]: Unit apache2.service entered failed state.
ноя 09 19:01:14 web sudo[1319]: pam_unix(sudo:session): session closed for user root
ноя 09 19:01:18 web sudo[1336]: web : TTY=pts/0 ; PWD=/home/web ; USER=root ; COMMAND=/bin/journalctl -xn
ноя 09 19:01:18 web sudo[1336]: pam_unix(sudo:session): session opened for user root by web(uid=0)
ноя 09 19:02:01 web sshd[1339]: Accepted publickey for web from 192.168.0.2 port 55390 ssh2: RSA 2d:45:4c:a9:c2:51:b1:94:64:1b:1d:7b:72:45:6e:10
ноя 09 19:02:01 web sshd[1339]: pam_unix(sshd:session): session opened for user web by (uid=0)
ноя 09 19:02:14 web sudo[1351]: web : TTY=pts/1 ; PWD=/home/web ; USER=root ; COMMAND=/bin/journalctl -xn
ноя 09 19:02:14 web sudo[1351]: pam_unix(sudo:session): session opened for user root by web(uid=0)
Не подскажете, в чём дело?
Откуда там на второй строчке это написано? И пробел лишний уберите.
я не совсем понял о чем вы
сейчас у меня стартовая страница zabbix выглядит как белый экран с каким то кодом:
<?php
/*
** Zabbix
** Copyright (C) 2001-2020 Zabbix SIA
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/require_once dirname(__FILE__).'/include/classes/user/CWebUser.php';
CWebUser::disableSessionCookie();
require_once
dirname(__FILE__).'/include/config.inc.php';
require_once dirname(__FILE__).'/include/forms.inc.php';$page['title'] = _('ZABBIX');
$page['file'] = 'index.php';// VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION
$fields = [
'name' => [T_ZBX_STR, O_NO, null, null, 'isset({enter}) && {enter} != "'.ZBX_GUEST_USER.'"', _('Username')],
'password' => [T_ZBX_STR, O_OPT, null, null, 'isset({enter}) && {enter} != "'.ZBX_GUEST_USER.'"'],
'sessionid' => [T_ZBX_STR, O_OPT, null, null, null],
'reconnect' => [T_ZBX_INT, O_OPT, P_SYS, null, null],
'enter' => [T_ZBX_STR, O_OPT, P_SYS, null, null],
'autologin' => [T_ZBX_INT, O_OPT, null, null, null],
'request' => [T_ZBX_STR, O_OPT, null, null, null],
'form' => [T_ZBX_STR, O_OPT, null, null, null]
];
check_fields($fields);$config = select_config();
if (
hasRequest('reconnect') && CWebUser::isLoggedIn()) {
if ($config['saml_auth_enabled'] == ZBX_AUTH_SAML_ENABLED && $config['saml_slo_url'] !== ''
&& CSession::keyExists('saml_data')) {
redirect('index_sso.php?slo');
} CWebUser::logout();
redirect('index.php');
}$autologin = hasRequest('enter') ? getRequest('autologin', 0) : getRequest('autologin', 1);
$request = getRequest('request', '');
if (
$request) {
$test_request = [];
preg_match('/^/?(?<filename>[a-z0-9_.]+.php)(?<request>?.*)?$/i', $request, $test_request); $request = (array_key_exists('filename', $test_request) && file_exists('./'.$test_request['filename']))
? $test_request['filename'].(array_key_exists('request', $test_request) ? $test_request['request'] : '')
: '';
}
if (!
hasRequest('form') && $config['http_auth_enabled'] == ZBX_AUTH_HTTP_ENABLED
&& $config['http_login_form'] == ZBX_AUTH_FORM_HTTP && !hasRequest('enter')) {
redirect('index_http.php'); exit;
}// login via form
if (hasRequest('enter') && CWebUser::login(getRequest('name', ZBX_GUEST_USER), getRequest('password', ''))) {
if (CWebUser::$data['autologin'] != $autologin) {
API::User()->update([
'userid' => CWebUser::$data['userid'],
'autologin' => $autologin
]);
} $redirect = array_filter([CWebUser::isGuest() ? '' : $request, CWebUser::$data['url'], ZBX_DEFAULT_URL]);
redirect(reset($redirect)); exit;
}
if (
CWebUser::isLoggedIn() && !CWebUser::isGuest()) {
redirect(CWebUser::$data['url'] ? CWebUser::$data['url'] : ZBX_DEFAULT_URL);
}$messages = clear_messages();
echo (new
CView('general.login', [
'http_login_url' => ($config['http_auth_enabled'] == ZBX_AUTH_HTTP_ENABLED)
? (new CUrl('index_http.php'))->setArgument('request', getRequest('request'))
: '',
'saml_login_url' => ($config['saml_auth_enabled'] == ZBX_AUTH_SAML_ENABLED)
? (new CUrl('index_sso.php'))->setArgument('request', getRequest('request'))
: '',
'guest_login_url' => CWebUser::isGuestAllowed() ? (new CUrl())->setArgument('enter', ZBX_GUEST_USER) : '',
'autologin' => $autologin == 1,
'error' => (hasRequest('enter') && $messages) ? array_pop($messages) : null
]))->getOutput();
че происходит, я не понимаю, сам по себе живет как-будто
check
Best Answer
![]()
Try checking is sites enabled in the server.
# apache2ctl -S
Also please copy last 20 lines in Apache error.log file.
This is not a good practice. I would suggest you to install Apache on a server and rsync /var/www folder and Apache config folder instead of sync Apache folder. If you want a high availability why not install load balancer? Haproxy would be a great option.
2 found this helpful
thumb_up
thumb_down
View Best Answer in replies below
17 Replies
-

try
sudo systemctl start apache2
That will probably error, then do
journalctl -xe
to see what it says is the issue.
Was this post helpful?
thumb_up
thumb_down
-

Hi Momurda,
This is what I get when I did the command:
Aug 13 15:11:58 apachectl[16715]: The Apache error log may have more information.
Aug 13 15:11:58 systemd[1]: apache2.service: Control process exited, code=exited status=1
Aug 13 15:11:58 systemd[1]: apache2.service: Failed with result ‘exit-code’.
Aug 13 15:11:58 systemd[1]: Failed to start The Apache HTTP Server.
— Subject: Unit apache2.service has failed
— Defined-By: systemd
— Support: http://www.ubuntu.com/support Opens a new window
—
— Unit apache2.service has failed.
Was this post helpful?
thumb_up
thumb_down
-

This is what it shows me
Control process exited, code=exited status=1
Failed with result ‘exit-code
Failed to start The Apache HTTP Server
Unit apache2.service has failed
Was this post helpful?
thumb_up
thumb_down
-
Aug 13 15:11:58 apachectl[16715]: The Apache error log may have more information.
Have you checked the content of the log file?
If you haven’t changed the config, it should be at
Text
/var/log/apache2/error.log
Was this post helpful?
thumb_up
thumb_down
-
Wish I could be more precise, but this Linux isn’t familiar to me.
When apache fails to start, i always run the equivalent the command to tell apache to «run a syntax check for config files».
In CentOS and the RedHat family of Liux distributions, this command «service httpd configtest».
Alternatively, try «apachectl -t» or «httpd -t» I got that from the output of «apachectl -h».
The main point is that it will run through the process of loading all the config files but not actually go to running. If you recently made a change but mistyped something, or some detail that it is pulling in is not able to be found, this will give show you the problem and then you can take it from there.
If you get «Ok», syntax is valid and what it wants to read in can be found so you can eliminate that as the problem. So you move on trying to start the service
Was this post helpful?
thumb_up
thumb_down
-

Check Apache error log in /var/log/apache2/ location. If not in this location check the system logs. It should write to the system log. Share your Apache site config file in sites_enabled location.
Did you enable a new site? Any changes made to Apache config files?
Was this post helpful?
thumb_up
thumb_down
-
Jim Peters wrote:
Wish I could be more precise, but this Linux isn’t familiar to me.
When apache fails to start, i always run the equivalent the command to tell apache to «run a syntax check for config files».
In CentOS and the RedHat family of Liux distributions, this command «service httpd configtest».
Alternatively, try «apachectl -t» or «httpd -t» I got that from the output of «apachectl -h».
The main point is that it will run through the process of loading all the config files but not actually go to running.
Not accessing an Ubuntu system to test at the moment, but I think
BASH
apache2ctl configtest
is the command that would be equivalent.
http://manpages.ubuntu.com/manpages/bionic/man8/apache2ctl.8.html Opens a new window
Was this post helpful?
thumb_up
thumb_down
-

Hi
Walker Dow,
When I do that command I don’t see any error logs, also I don’t get a syntax error but still unable to start apache.
Was this post helpful?
thumb_up
thumb_down
-

Not a new site, it is out backup production server that has a rsync command to copy the apache2 folder but stopped working suddenly yesterday.
I have deleted the apache2 folder ran the rsync copied back the apache2 folder from the production server but still not working, and the production server is running apache2 fine without an issue.
Also, I was reading into this issue, and a few people have said to do the command «sudo apt-get -o DPkg::Options::=»—force-confmiss» —reinstall install apache2″ is that a command I should try or any recommendations on what I could do?
Was this post helpful?
thumb_up
thumb_down
-

So this is a replica of production server? You cannot just clone production as it is. I’m not sure what you want to archive in here. I would suggest to check hostname and hosts files. Let me know detail what you want to archive so I can help more
Was this post helpful?
thumb_up
thumb_down
-

This is the command we run from the production to the backup »
rsync -raz —delete root@our IP Address :/etc/apache2 /etc/ && /usr/sbin/service apache2 reload
We would fail over if there is ever an issue on the main server.
Was this post helpful?
thumb_up
thumb_down
-

Try checking is sites enabled in the server.
# apache2ctl -S
Also please copy last 20 lines in Apache error.log file.
This is not a good practice. I would suggest you to install Apache on a server and rsync /var/www folder and Apache config folder instead of sync Apache folder. If you want a high availability why not install load balancer? Haproxy would be a great option.
2 found this helpful
thumb_up
thumb_down
-

The last 20 lines are below:
[Tue Aug 13 15:10:49.376005 2019] [ssl:emerg] [pid 16661:tid 109225548622784] AH02312: Fatal error initialising mod_ssl, exiting.
AH00016: Configuration Failed
[Tue Aug 13 15:11:58 2019] [emerg] ssl_engine_init.c(1778): [client AH02572: Failed to configure at least one certificate and key for abbotsford.rooter.ca:80
[Tue Aug 13 15:11:58 2019] [emerg] ssl_engine_init.c(1779): [client SSL Library Error: error:0906D06C:PEM routines:PEM_read_bio:no start line (Expecting: DH PARAMETERS) — Bad file contents or format — or even just a forgotten SSLCertificateKeyFile?
[Tue Aug 13 15:11:58 2019] [emerg] ssl_engine_init.c(1779): [client SSL Library Error: error:0906D06C:PEM routines:PEM_read_bio:no start line (Expecting: EC PARAMETERS) — Bad file contents or format — or even just a forgotten SSLCertificateKeyFile?
[Tue Aug 13 15:11:58 2019] [emerg] ssl_engine_init.c(1779): [client SSL Library Error: error:140A80B1:SSL routines:SSL_CTX_check_private_key:no certificate assigned
[Tue Aug 13 15:11:58.892180 2019] [ssl:emerg] [pid 16718:tid 134672433605568] AH02312: Fatal error initialising mod_ssl, exiting.
AH00016: Configuration Failed
[Wed Aug 14 09:17:53 2019] [emerg] ssl_engine_init.c(1778): [client AH02572: Failed to configure at least one certificate and key for abbotsford.rooter.ca:80
[Wed Aug 14 09:17:53 2019] [emerg] ssl_engine_init.c(1779): [client SSL Library Error: error:0906D06C:PEM routines:PEM_read_bio:no start line (Expecting: DH PARAMETERS) — Bad file contents or format — or even just a forgotten SSLCertificateKeyFile?
[Wed Aug 14 09:17:53 2019] [emerg] ssl_engine_init.c(1779): [client SSL Library Error: error:0906D06C:PEM routines:PEM_read_bio:no start line (Expecting: EC PARAMETERS) — Bad file contents or format — or even just a forgotten SSLCertificateKeyFile?
[Wed Aug 14 09:17:53 2019] [emerg] ssl_engine_init.c(1779): [client SSL Library Error: error:140A80B1:SSL routines:SSL_CTX_check_private_key:no certificate assigned
[Wed Aug 14 09:17:53.224680 2019] [ssl:emerg] [pid 5383:tid 113181818239936] AH02312: Fatal error initialising mod_ssl, exiting.
AH00016: Configuration Failed
[Wed Aug 14 09:49:11 2019] [emerg] ssl_engine_init.c(1778): [client AH02572: Failed to configure at least one certificate and key for abbotsford.rooter.ca:80
[Wed Aug 14 09:49:11 2019] [emerg] ssl_engine_init.c(1779): [client SSL Library Error: error:0906D06C:PEM routines:PEM_read_bio:no start line (Expecting: DH PARAMETERS) — Bad file contents or format — or even just a forgotten SSLCertificateKeyFile?
[Wed Aug 14 09:49:11 2019] [emerg] ssl_engine_init.c(1779): [client SSL Library Error: error:0906D06C:PEM routines:PEM_read_bio:no start line (Expecting: EC PARAMETERS) — Bad file contents or format — or even just a forgotten SSLCertificateKeyFile?
[Wed Aug 14 09:49:11 2019] [emerg] ssl_engine_init.c(1779): [client SSL Library Error: error:140A80B1:SSL routines:SSL_CTX_check_private_key:no certificate assigned
[Wed Aug 14 09:49:11.793774 2019] [ssl:emerg] [pid 6913:tid 107806533581760] AH02312: Fatal error initialising mod_ssl, exiting.
AH00016: Configuration FailedAlso, I will talk to our Developer about those options you recommended.
Was this post helpful?
thumb_up
thumb_down
-

Your rsync
Text
rsync -raz --delete root@our IP Address :/etc/apache2 /etc/ && /usr/sbin/service apache2 reload
isnt copying the ssl certs, if this the rsync command.
If you wanted to have them copied over you would include the certificate path in your rsync, which you can find in the /etc/apache2/sites-enabled/sitename.conf file under SSLCertficateFile and SSLCertificateKey
You also might not have correct apache mods enabled on the backup server.
Was this post helpful?
thumb_up
thumb_down
-

How would I check what is enabled, also it was working fine up until yesterday when it synced and it didn’t come back online
Was this post helpful?
thumb_up
thumb_down
-

Found the issue with apache2, it was one of the sites .conf that needed to be fixed and after that was done I was able to get apache2 back up and running.
The
apache2ctl -S command helped me find the error log since it had a different name which led me to the logs to fix the one site that was causing the issue.
1 found this helpful
thumb_up
thumb_down
-
spicehead-pbn31 wrote:
How would I check what is enabled, also it was working fine up until yesterday when it synced and it didn’t come back online
Use the commands
a2ensite (or a2dissite) [ [-q|—quiet] site] to enable or disable virtual hosts in Apache2.
To figure out which sites you have enabled, use:
# ls /etc/apache2/sites-enabled/
the directory above automatically adds and removes sym-links for your enabled sites, which makes it easy to check which sites are currently enabled.
Next, attempt to restart Apache2 using:
# apachectl restart
Once Apache2 is restarted, check its status with:
# apachectl status
Apache’s Debian Package Page Opens a new window Opens a new window
Apache’s Manual Page Opens a new window Opens a new window
Apache’s apachectl man page Opens a new window Opens a new window
Apache’s a2ensite man page Opens a new window Opens a new window
Was this post helpful?
thumb_up
thumb_down
libapache2-mod-qos – это один из модулей Apache для защиты от атак Slowloris (разновидность DoS атак).
QS_SrvMinDataRate – один из параметров мода libapache2-mod-qos. Он прописывался в файле /etc/apache2/mods-available/qos.conf и до недавнего времени прекрасно работал.
Если сейчас попробовать сделать то же самое, то нас ждёт неудача при попытке перезапуска Apache:
root@WebWare-Debian:~# service apache2 restart Job for apache2.service failed. See 'systemctl status apache2.service' and 'journalctl -xn' for details.
Хорошо, смотрим подробности:
root@WebWare-Debian:~# systemctl status apache2.service ● apache2.service - LSB: Apache2 web server Loaded: loaded (/etc/init.d/apache2) Active: failed (Result: exit-code) since Вс 2015-06-28 18:26:41 ICT; 2min 12s ago Process: 3494 ExecStop=/etc/init.d/apache2 stop (code=exited, status=0/SUCCESS) Process: 3519 ExecStart=/etc/init.d/apache2 start (code=exited, status=1/FAILURE) июн 28 18:26:41 WebWare-Debian apache2[3519]: Starting web server: apache2 failed! июн 28 18:26:41 WebWare-Debian apache2[3519]: The apache2 configtest failed. ... (warning). июн 28 18:26:41 WebWare-Debian apache2[3519]: Output of config test was: июн 28 18:26:41 WebWare-Debian apache2[3519]: AH00526: Syntax error on line 15 of /etc/apache2/mods-enabled/qos.conf: июн 28 18:26:41 WebWare-Debian apache2[3519]: Invalid command 'QS_SrvMinDataRate', perhaps misspelled or defined by a module not included in the server configuration июн 28 18:26:41 WebWare-Debian apache2[3519]: Action 'configtest' failed. июн 28 18:26:41 WebWare-Debian apache2[3519]: The Apache error log may have more information. июн 28 18:26:41 WebWare-Debian systemd[1]: apache2.service: control process exited, code=exited status=1 июн 28 18:26:41 WebWare-Debian systemd[1]: Failed to start LSB: Apache2 web server. июн 28 18:26:41 WebWare-Debian systemd[1]: Unit apache2.service entered failed state.
А также:
root@WebWare-Debian:~# journalctl -xn -- Logs begin at Вс 2015-06-28 11:52:12 ICT, end at Вс 2015-06-28 18:26:41 ICT. -- июн 28 18:26:41 WebWare-Debian apache2[3519]: Starting web server: apache2 failed! июн 28 18:26:41 WebWare-Debian apache2[3519]: The apache2 configtest failed. ... (warning). июн 28 18:26:41 WebWare-Debian apache2[3519]: Output of config test was: июн 28 18:26:41 WebWare-Debian apache2[3519]: AH00526: Syntax error on line 15 of /etc/apache2/mods-enabled/qos.conf: июн 28 18:26:41 WebWare-Debian apache2[3519]: Invalid command 'QS_SrvMinDataRate', perhaps misspelled or defined by a module not included in the server configuration июн 28 18:26:41 WebWare-Debian apache2[3519]: Action 'configtest' failed. июн 28 18:26:41 WebWare-Debian apache2[3519]: The Apache error log may have more information. июн 28 18:26:41 WebWare-Debian systemd[1]: apache2.service: control process exited, code=exited status=1 июн 28 18:26:41 WebWare-Debian systemd[1]: Failed to start LSB: Apache2 web server. -- Subject: Ошибка юнита apache2.service -- Defined-By: systemd -- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- Произошел сбой юнита apache2.service. -- -- Результат: failed. июн 28 18:26:41 WebWare-Debian systemd[1]: Unit apache2.service entered failed state.
Итак, синтаксическая ошибка в пятнадцатой строке файла /etc/apache2/mods-enabled/qos.conf, Apache не знает больше директиву QS_SrvMinDataRate.
Уже 20 марта 2015 года на дебиановском баг-трекере появилось сообщение о «баге» и с тех пор оно только обрастает подтверждениями https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=780832.
В чейнджлоге mod_qos были найдены строки:
- Experimental: mod_qos compiles with Apache 2.4
* QS_SrvMinDataRate is not available (does not work, use mod_reqtimeout
instead)
* QS_Srv* directives shall not be used (connection cleanup takes
very long)
Разберёмся сначала с первой: QS_SrvMinDataRate недоступен (не работает, используйте вместо него mod_reqtimeout.
Ну с этим всё просто:
a2enmod reqtimeout service apache2 restart
Для настройки mod_reqtimeout нужно редактировать файл /etc/apache2/mods-enabled/reqtimeout.conf
vim /etc/apache2/mods-enabled/reqtimeout.conf
Вопрос в следующей фразе: Директивы QS_Srv* не должны использоваться (очищение соединений проходит очень долго) — я до сих пор не понимаю, эта проблема уже была устранена в последующих версиях или нет? Подскажите, кто знает.