Ah00558 apache2 ошибка

В этом мануале вы узнаете, как применить алгоритм, чтобы обнаружить AH00558. Мы также поможем вам установить директиву ServerName, чтобы устранить эту ошибку.

26 сентября, 2020 12:02 пп
24 416 views
| Комментариев нет

LAMP Stack

Эта серия мануалов поможет вам предотвратить или устранить самые распространенные ошибки, которые возникают при работе с веб-сервером Apache.

Каждый мануал в этой серии включает описание распространенных ошибок Apache, связанных с конфигурацией, сетью, файловой системой или привилегиями.

Ошибка конфигурации Apache «AH00558: Could not reliably determine the server’s fully qualified domain name» возникает, когда в настройках Apache нет глобальной директивы ServerName. Сообщение в основном предназначено для информирования, и сама по себе ошибка AH00558 не помешает правильной работе Apache.

В этом мануале вы узнаете, как применить алгоритм, описанный в руководстве Устранение общих ошибок Apache, чтобы обнаружить AH00558. Мы также поможем вам установить директиву ServerName, чтобы устранить эту ошибку.

Примечание: Если вы уже определили, что на вашем сервере Apache появляется ошибка AH00558, вы можете пропустить разделы по поиску неполадок и сразу перейти к последнему разделу этого мануала, чтобы установить глобальную директиву ServerName.

Поиск ошибки с помощью systemctl

Первый шаг при устранении AH00558 – это проверить статус Apache с помощью systemctl. Вывод systemctl часто содержит всю информацию, необходимую для исправления ошибки.

В дистрибутивах Ubuntu и Debian запустите следующую команду, чтобы проверить статус Apache:

sudo systemctl status apache2.service -l --no-pager

В CentOS, Fedora и других системах, производных от RedHat, используйте эту команду:

sudo systemctl status httpd.service -l --no-pager

Флаг -l выводит все содержимое строки без сокращений (без замены длинных строк многоточием (…)). Флаг –no-pager выводит весь лог на ваш экран, не вызывая инструмент less, который показывает только один экран контента за раз.

Вы должны получить такой вывод:

apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Drop-In: /lib/systemd/system/apache2.service.d
└─apache2-systemd.conf
Active: active (running) since Wed 2020-07-29 14:30:03 UTC; 33min ago
Process: 34 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
Main PID: 46 (apache2)
Tasks: 55 (limit: 2344)
CGroup: /system.slice/apache2.service
├─46 /usr/sbin/apache2 -k start
├─47 /usr/sbin/apache2 -k start
└─48 /usr/sbin/apache2 -k start
Jul 29 14:30:03 68e2cf19f3f1 systemd[1]: Starting The Apache HTTP Server...
Jul 29 14:30:03 68e2cf19f3f1 apachectl[34]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
Jul 29 14:30:03 68e2cf19f3f1 systemd[1]: Started The Apache HTTP Server.

Обратите внимание на выделенную строку, содержащую сообщение об ошибке AH00558. По сути, она говорит вам, что Apache не смог найти валидную директиву ServerName в своем конфигурационном файле, поэтому он будет использовать первый обнаруженный IP-адрес. В данном примере это внешний IP-адрес сервера: 172.17.02. В вашем случае IP-адрес может быть другим, это также может быть человекочитаемое DNS-имя.

Если ваш вывод systemctl предлагает вам любое автоматически определяемое значение IP-адреса или хоста, перейдите к последнему разделу этого руководства, чтобы установить глобальную директиву ServerName и решить проблему (этот раздел поможет установить для Apache безопасное значение ServerName по умолчанию, используя IP-адрес localhost: 127.0.0.1).

Если в выходных данных systemctl не указано значение, которое можно использовать для директивы ServerName, в следующем разделе этого мануала мы расскажем, как исследовать логи systemd с помощью journalctl для поиска информации о AH00558.

Устранение ошибки с помощью journalctl

Чтобы проверить логи systemd для Apache, воспользуйтесь командой journalctl. При вызове journalctl есть два особых флага, которые помогут вам найти определенные сообщения среди других записей.

Первый флаг, который нужно добавить к journalctl – это флаг –since today. он ограничит вывод команды только теми записями, которые были зарегистрированы в логе с 00:00:00 текущего дня. Использование этой опции поможет ограничить объем выведенных записей, которые вам придется изучить при поиске ошибок.

Второй флаг, который мы советуем использовать, – это опция –no-pager, которую вы применили в systemctl. Она сразу выводит весь лог на экран.

В системах Ubuntu и Debian выполните следующую команду:

sudo journalctl -u apache2.service --since today --no-pager

В CentOS, Fedora и других RedHat-подобных системах используйте эту команду:

sudo journalctl -u httpd.service --since today --no-pager

Если на вашем сервере Apache есть ошибка AH00558, просмотрите вывод journalctl и найдите такую строку:

-- Logs begin at Wed 2020-07-29 14:30:02 UTC, end at Wed 2020-07-29 14:45:03 UTC. --
. . .
Jul 29 14:30:03 68e2cf19f3f1 systemd[1]: Starting The Apache HTTP Server...
Jul 29 14:30:03 68e2cf19f3f1 apachectl[34]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
Jul 29 14:30:03 68e2cf19f3f1 systemd[1]: Started The Apache HTTP Server.

Вторая строка вывода – это сообщение об ошибке AH00558. Строка содержит внешний IP-адрес сервера, который Apache автоматически определяет и устанавливает по умолчанию во время выполнения. Получив это сообщение как подтверждение ошибки AH00558, вы можете перейти к настройке глобальной директивы ServerName для решения проблемы.

В следующем разделе мы расскажем, как диагностировать ошибку AH00558 с помощью команды apachectl.

Поиск ошибки с помощью apachectl

Ошибка AH00558 может быть обнаружена с помощью утилиты Apache apachectl. Она может перехватывать подобные сообщения перед перезагрузкой или перезапуском Apache, и вам не придется искать ошибки в логах systemctl и journalctl.

Чтобы проверить конфигурацию Apache на наличие ошибки AH00558, выполните следующую команду:

sudo apachectl configtest

Вы должны получить следующий вывод, если на вашем сервере действительно есть ошибка AH00558:

AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
Syntax OK

Как и в предыдущих разделах этого мануала, в которых для поиска сообщений AH00558 использовались systemctl и journalctl, здесь важно найти строку, содержащую сообщение AH00558. Еще раз обратите внимание, что IP-адрес (172.17.0.2) у вас может отличаться.

В следующем разделе мы поможем установить директиву ServerName для устранения сообщений об ошибках AH00558.

Установка глобальной директивы ServerName

Чтобы устранить ошибку AH00558, необходимо добавить директиву ServerName в конфигурацию Apache. Apache использует директиву ServerName для сопоставления входящих HTTP-запросов с IP-адресом или именем DNS хоста (с помощью директив VirtualHost) для обработки запросов нескольких сайтов, размещенных в рамках одного сервера.

В сообщении об ошибке отмечается, что также нужно установить ​​глобальную директиву ServerName. С ее помощью Apache сможет корректно обрабатывать входящие запросы, которые не сопоставляются с VirtualHost, не выдавая при этом дополнительных ошибок.

Для максимальной совместимости с различными конфигурациями Apache используйте для вашей глобальной директивы ServerName значение 127.0.0.1. При необходимости вы можете использовать другой IP-адрес или DNS-имя, соответствующее конфигурации вашего сервера, но безопаснее всего использовать 127.0.0.1.

В системах Ubuntu и Debian откройте файл /etc/apache2/apache2.conf с правами root:

sudo nano /etc/apache2/apache2.conf

Добавьте в конец файла строку ServerName 127.0.0.1:

. . .
# Include the virtual host configurations:
IncludeOptional sites-enabled/*.conf
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
ServerName 127.0.0.1

В CentOS, Fedora и других системах RedHat откройте файл /etc/httpd/conf/httpd.conf с правами root:

sudo nano /etc/httpd/conf/httpd.conf

Добавьте строку ServerName 127.0.0.1 в конец файла:

. . .
# Supplemental configuration
#
# Load config files in the "/etc/httpd/conf.d" directory, if any.
IncludeOptional conf.d/*.conf
ServerName 127.0.0.1

Сохраните и закройте файл, когда закончите.

После добавления директивы ServerName в конфигурацию запустите apachectl, чтобы проверить ошибки в обновленной конфигурации веб-сервера.

sudo apachectl configtest

Если apachectl не обнаружила ошибок в конфигурации, вы увидите:

Syntax OK

Теперь вы можете перезапустить Apache, используя соответствующую команду systemctl restart для вашего дистрибутива Linux.

В системах Ubuntu и Debian запустите:

sudo systemctl restart apache2.service

В системах CentOS, Fedora и RedHat используйте эту команду:

sudo systemctl restart httpd.service

После перезапуска Apache сообщение об ошибке AH00558 больше не будет отображаться в ваших логах. Вы можете убедиться, что сообщения исчезли, выполнив любую из трех команд systemctl, journalctl или apachectl, которые мы использовали ранее в этом руководстве.

Заключение

В этом мануале вы познакомились с ошибкой AH00558: Could not reliably determine the server’s fully qualified domain name. Хотя эти сообщения не препятствуют запуску Apache, их можно устранить, установив глобальную директиву ServerName.

Вы узнали, как искать сообщения об ошибках AH00558 с помощью команд systemctl, journalctl и apachectl и как отредактировать конфигурацию Apache в различных дистрибутивах Linux, чтобы эти сообщения больше не отображались.

Если вы хотите узнать больше о том, как Apache использует директивы ServerName, обратитесь к документации Apache.

Tags: Apache, apachectl, CentOS, Debian, Fedora, journalctl, systemctl, Ubuntu

I have just installed Apache 2.2.17, and I am using it for the first time.

Now when I try to start the server using the command service httpd start it gives me the message:

httpd: Could not reliably determine the server’s fully qualified domain name, using ::1 for ServerName

Now I think I have to set ServerName and the IP address as I search through Google. But I don’t know in which file I have to set.

How can I fix this problem?

crmpicco's user avatar

crmpicco

16.2k25 gold badges126 silver badges208 bronze badges

asked May 2, 2011 at 10:46

mahesh's user avatar

  1. sudo vim /etc/apache2/httpd.conf
  2. Insert the following line at the httpd.conf: ServerName localhost
  3. Just restart the Apache: sudo /etc/init.d/apache2 restart

answered Nov 22, 2011 at 16:00

Douglas Miranda's user avatar

4

I was NOT getting the ServerName wrong. Inside your VirtualHost configuration that is causing this warning message, it is the generic one near the top of your httpd.conf which is by default commented out.

Change

#ServerName www.example.com:80

to:

  ServerName 127.0.0.1:80

Peter Mortensen's user avatar

answered Oct 9, 2013 at 9:54

zzapper's user avatar

zzapperzzapper

4,6635 gold badges47 silver badges45 bronze badges

Under Debian Squeeze;

  1. Edit Apache2 conf file : vim /etc/apache2/apache2.conf
  2. Insert the following line at the apache2.conf: ServerName localhost
  3. Restart Apache2: apache2ctl restart or /etc/init.d/apache2 restart

Should work fine (it did solve the problem in my case)

tks noodl for the link on the different layouts. :)

answered Apr 23, 2012 at 9:26

Bernard Sfez's user avatar

Bernard SfezBernard Sfez

1,3192 gold badges15 silver badges18 bronze badges

0

  1. sudo nano /etc/apache2/httpd.conf
  2. search for a text ServerName in nano editor <Ctrl + W>
  3. Insert the following line at the httpd.conf: ServerName localhost
  4. Just restart the Apache: sudo /usr/sbin/apachectl restart

answered Oct 8, 2017 at 23:35

Yevgeniy Afanasyev's user avatar

Another option is to ensure that the full qualified host name (FQDN) is listed in /etc/hosts.
This worked for me on Ubuntu v11.10 without having to change the default Apache configuration.

answered May 15, 2012 at 18:47

Lars Nordin's user avatar

Lars NordinLars Nordin

2,7251 gold badge22 silver badges24 bronze badges

0

» To solve this problem You need set ServerName.

1: $ vim /etc/apache2/conf.d/name
For example set add ServerName localhost or any other name:

2: ServerName localhost
Restart Apache 2

3: $ service apache restart
For this example I use Ubuntu 11.10.1.125″

Raja Mohamed's user avatar

answered Apr 12, 2019 at 5:15

Alice Wright's user avatar

FQDN means the resolved name over DNS. It should be like «server-name.search-domain».

The warning you get just provides a notice that httpd can not find a FQDN, so it might not work right to handle a name-based virtual host. So make sure the expected FQDN is registered in your DNS server, or manually add the entry in /etc/hosts which is prior to hitting DNS.

Peter Mortensen's user avatar

answered Jul 11, 2013 at 0:42

shawnzhu's user avatar

shawnzhushawnzhu

7,0183 gold badges33 silver badges50 bronze badges

If you are using windows there is something different sort of situation

First open c:/apache24/conf/httpd.conf.
The Apache folder is enough not specifically above path

After that you have to configure httpd.conf file.

Just after few lines there is pattern like:

#Listen _____________:80
Listen 80

Here You have to change for the localhost.

You have to enter ipv4 address for that you can open localhost.

Refer this video link and after that just bit more.

Change your environment variables:

Image for Environment USER Variables in System setting

In which you have to enter path:

c:apache24/bin

and
same in the SYSTEM variables

Image is for system variables path

If any query feel free to ask.

Brian Tompsett - 汤莱恩's user avatar

answered Jul 14, 2018 at 9:28

ankit's user avatar

ankitankit

111 bronze badge

Two things seemed to do it for me:

  1. Put all aliases for 127.0.0.1 in /etc/hosts in a single line (e.g. 127.0.0.1 localhost mysite.local myothersite.local
  2. Set ServerName in my httpd.conf to 0.0.0.0 (localhost or 127.0.0.1 didn’t work for me)

Editing /etc/hosts got rid of long response times and setting the ServerName got rid of OP’s warning for me.

answered Jun 23, 2015 at 15:02

Benjamin Bojko's user avatar

Benjamin BojkoBenjamin Bojko

5541 gold badge7 silver badges14 bronze badges

who are still couldnt resolve the problem and using mac then follow this

1.goto the root folder /

  1. cd usr/local/etc/apache2/2.4

3.sudo nano httpd.conf

4.change #servername to ServerName 127.0.0.1:8080 press ctrl+o,+return+ctrl x

5.then restart the server apachectl restart

answered Feb 10, 2017 at 6:02

javaguru's user avatar

If you are using windows, remove comment on these lines and set them as:

Line 227 : ServerName 127.0.0.1:80 
Line 235 : AllowOverride all 
Line 236 : Require all granted

Worked for me!

Boendal's user avatar

Boendal

2,4961 gold badge22 silver badges36 bronze badges

answered Dec 20, 2019 at 19:47

hitesh kumar's user avatar

2

Here’s my two cents. Maybe it’s useful for future readers.

I ran into this problem when using Apache within a Docker container. When I started a container from an image of the Apache webserver, this message appeared when I started it with docker run -it -p 80:80 my-apache-container.

However, after starting the container in detached mode, using docker run -d -p 80:80 my-apache-container, I was able to connect through the browser.

answered Apr 2, 2020 at 19:58

MC Emperor's user avatar

MC EmperorMC Emperor

21.9k14 gold badges80 silver badges127 bronze badges

I am using ubuntu 22.04

I installed the apache2 at the location ‘/usr/local/apache2’

I just edited the ‘/usr/local/apache2/conf/httpd.conf’ file.

run the following commands

cd /usr/local/apache2/conf

sudo nano httpd.conf

find this comment

#ServerName www.example.com:80, in my case it is at line 197

after that add this

ServerName localhost

don’t modify anything else in this file!

Thank you!

answered Sep 21, 2022 at 6:28

Khalil Ahmad's user avatar



14 Dec, 21



by Antoniy Yushkevych



1 min Read

Apache could not reliably determine the server's fully qualified domain name

When attempting to install an Apache web server on Windows server you may face a very common error. You will encounter this problem when you will try to install and set up the latest versions of Apache. The error AH00558 requires you to set the ‘ServerName’ directive globally. 

Before fixing the problem here’s a preview of the error that you will see on your screen.

AH00558: httpd.exe: Could not reliably determine the server's fully qualified domain name, using fe80::7077:eaf3:2440:24a1. Set the 'ServerName' directive globally to suppress this message

Apache Could not determine the server's qualified domain name

How to solve the Apache error AH00558:

To solve this we should determine the server name in Apache config file.

Apache config file is located in C:Apache24confhttpd.conf

1. open C:Apache24confhttpd.conf with notepad or any other text editor.

2. search for this line in config file «#ServerName www.example.com:80«

3. uncomment this line by removing # from the first of line and edit as below

ServerName 127.0.0.1

4. save the file and exit

This will definitely solve the problem. You can check it yourself: run apache by running httpd.exe.

apache-running

If it worked let us know your thoughts in the comments below. For the full guide on setting up Apache, check our «Full Apache installation guide» from here. 

https://monovm.com/blog/how-to-install-apache-on-windows/

Trying to fix Apache error AH00558? We can help you with it.

Apache shows this message when it couldn’t find the server name.

At Bobcares, we often get requests regarding Apache errors, as a part of our Server Management Services.

Today, let’s see how our Support Engineers fix Apache error for our customers.

When does this Apache error AH00558 occur?

This error message appears mainly when:

  • Stopping an Apache service
  • We start an Apache service
  • We restart an Apache service

But, why this appears is the main question. Today, let’s discuss in detail on Apache error AH00558 and see how our Support Engineers find the fix for this warning message.

How we fix Apache error AH00558?

Recently, one of our customers approached us saying that he is getting a warning error message like the one shown below when he is trying to restart the Apache service.

Apache error ah00558

So, we checked in detail and found that there was no  “ServerName” directive added in the configuration file. That’s why Apache complained about this error message.

So, we added the following in ‘/etc/apache2/apache2.conf’ file.

ServerName FQDN

Here, FQDN is the Fully Qualified Domain Name. Usually, this will be something like srv.domain.com which correctly resolves to an IP address.
Finally, we restarted the service using ‘service apache2 restart‘. This removed the Apache AH00558 warning.

Note: The  ServerName directive can either be an IP-address, or fully qualified domain name, or hostname, depending on the way we are planning to set up Apache.

Also, we handled a situation where the customers approached us with the same Apache warning message, but he said that he needs to run Apache for internal testing purposes only.

So, we set the ServerName directive to the IP-address of his server and restarted the service. Finally, Apache restarted without the error AH00558.

ServerName IP Address 

[Need any assistance with Apache errors? – We’ll help you]

Conclusion

In short, this error message can be avoided by adding the ServerName directive in the Apache configuration file. Today, we discussed in detail how our Support Engineers fix this warning message.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = «owonCMyG5nEQ0aD71QM»;

In this article, we will look into the steps required to solve  «AH00558: httpd: Could not reliably determine the server’s fully qualified domain name,» error. the Recently I was working to bring up my Apache web server to host my PHP Applications on Port 443 but while bringing up the service I noticed «AH00558: httpd: Could not reliably determine the server’s fully qualified domain name, using localhost.localdomain. Set the ‘ServerName’ directive globally to suppress this message» error on the output. So I thought to put all the troubleshooting steps in an article so that it will help you guys also if you are facing the same issue.

Solved: AH00558: httpd: Could not reliably determine the server's fully qualified domain name 2

Also Read: Dynamic Memory Allocations with malloc(), calloc(), free() and realloc() functions in C

Step 1: Check the httpd Service Status

After setting up my Apache web Server when I restarted the httpd service using service httpd restart command then I saw that the httpd.service is failing with below error message.

[root@localhost private]# service httpd restart
Redirecting to /bin/systemctl restart httpd.service
Job for httpd.service failed because the control process exited with error code.See "systemctl status httpd.service" and "journalctl -xe" for details.

I tried to check the complete error message on the output by checking the httpd service status using service httpd status -l command as shown below.

[root@localhost ~]# service httpd status -l
Redirecting to /bin/systemctl status -l httpd.service
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Wed 2020-10-14 06:06:41 EDT; 44s ago
Docs: man:httpd(8)
man:apachectl(8)
Process: 6576 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
Main PID: 6576 (code=exited, status=1/FAILURE)

Oct 14 06:06:40 localhost.localdomain systemd[1]: Starting The Apache HTTP Server...
Oct 14 06:06:41 localhost.localdomain httpd[6576]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message
Oct 14 06:06:41 localhost.localdomain systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Oct 14 06:06:41 localhost.localdomain systemd[1]: Failed to start The Apache HTTP Server.
Oct 14 06:06:41 localhost.localdomain systemd[1]: Unit httpd.service entered failed state.
Oct 14 06:06:41 localhost.localdomain systemd[1]: httpd.service failed.

Step 2: Check journalctl Logs

If you want to check more about the error then you can look for journalctl logs using journalctl -xe command as shown below. You can check 32 Best journalctl command examples in Linux(Redhat/CentOS) Part-1 and 32 Best journal command examples in Linux(RedHat/CentOS) Part — 2 to know more about journalctl.

[root@localhost ~]# journalctl -xe
Oct 14 05:55:08 localhost.localdomain systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Oct 14 05:55:08 localhost.localdomain systemd[1]: Failed to start The Apache HTTP Server.
-- Subject: Unit httpd.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit httpd.service has failed.
--
-- The result is failed.
Oct 14 06:06:41 localhost.localdomain httpd[6576]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. S
Oct 14 06:06:41 localhost.localdomain systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Oct 14 06:06:41 localhost.localdomain systemd[1]: Failed to start The Apache HTTP Server.
-- Subject: Unit httpd.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit httpd.service has failed.
--
-- The result is failed.

Step 3: Check /etc/hosts file

Error is basically talking about using fully qualified domain name so if you are running any local web server then you can first look into the /etc/hosts file and check the mapping of FQDN to IP Address is correct or not. If the Server hostname is published through DNS Server then you need not to verify from this file and you should go ahead with the next steps.

[root@localhost ~]# vi /etc/hosts

Step 4: Check Apache configuration using apachectl

You can also verify the apache configuration by using apachectl configtest command as shown below. This will tell you about any Syntax error or any other error configuration file currently has. In my case it shows the "AH00558: httpd: Could not reliably determine the server's fully qualified domain name" error which means it has some issue.

[root@localhost ~]# apachectl configtest
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message
Syntax OK

Step 5: Check Apache ssl.conf configuration file

Next step is to check the apache ssl.conf configuration file. Here you need to check the ServerName directive and verify that Server Name is correct here. Since the error talks about using Global ServerName directive so you can try to provide the ServerName at the end of the file i.e outside any VirtualHost directive as you can see below.

[root@localhost ~]# vi /etc/httpd/config.d/ssl.conf
Add ServerName at the end of ssl.conf
BrowserMatch "MSIE [2-5]" 
nokeepalive ssl-unclean-shutdown 
downgrade-1.0 force-response-1.0

# Per-Server Logging:
# The home of a custom SSL log file. Use this when you want a
# compact non-error SSL logfile on a virtual host basis.
CustomLog logs/ssl_request_log 
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x "%r" %b"

</VirtualHost>
ServerName test.cyberithub.com:443

NOTE:

If you notice we are configuring ssl.conf here instead of default apache httpd.conf configuration file. This is because we are enabling https service on Port 443 which also requires mod_ssl module. Generally we use httpd.conf file when we are enabling Apache web service on Port 80.

Step 6: Check SELinux Policy

Then you also need to check the SELinux configuration by using sestatus command. There is a chance that SELinux rule might block the apache service. In our case, currently it is set to enforcing mode so I would like to change the Current mode from Enforcing to Permissive and then check once. If you don’t need SELinux, then you can disable it as well.

[root@localhost ~]# sestatus
SELinux status: enabled
SELinuxfs mount: /sys/fs/selinux
SELinux root directory: /etc/selinux
Loaded policy name: targeted
Current mode: enforcing
Mode from config file: enforcing
Policy MLS status: enabled
Policy deny_unknown status: allowed
Max kernel policy version: 31

We can temporaily disable the SELinux by using setenforce 0 command as shown below and then if we again check the SELinux status using sestatus command then we can see it has now changed to Permissive mode.

[root@localhost ~]# setenforce 0
[root@localhost ~]# sestatus
SELinux status: enabled
SELinuxfs mount: /sys/fs/selinux
SELinux root directory: /etc/selinux
Loaded policy name: targeted
Current mode: permissive
Mode from config file: enforcing
Policy MLS status: enabled
Policy deny_unknown status: allowed
Max kernel policy version: 31

Step 7: Check Firewall Rules

If you are running any firewall in your Server then you need to allow the Port 443 through firewall. More on service command Man Page.

[root@localhost ~]# service firewalld status
Redirecting to /bin/systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2020-10-14 04:17:20 EDT; 2h 9min ago
Docs: man:firewalld(1)
Main PID: 15329 (firewalld)
CGroup: /system.slice/firewalld.service
└─15329 /usr/bin/python2 -Es /usr/sbin/firewalld --nofork --nopid

Oct 14 04:17:19 localhost.localdomain systemd[1]: Stopped firewalld - dynamic firewall daemon.
Oct 14 04:17:19 localhost.localdomain systemd[1]: Starting firewalld - dynamic firewall daemon...
Oct 14 04:17:20 localhost.localdomain systemd[1]: Started firewalld - dynamic firewall daemon.
Oct 14 04:17:20 localhost.localdomain firewalld[15329]: WARNING: AllowZoneDrifting is enabled. This is considered an insecure configuration option. It will ...g it now.
Hint: Some lines were ellipsized, use -l to show in full.

You can allow https service through firewall using firewall-cmd —zone=public —add-service=https command as shown below. You can check 26 Useful firewall CMD Examples on RedHat/CentOS 7 to know more about firewall-cmd command.

[root@localhost ~]# firewall-cmd --zone=public --add-service=https

Step 8: Check IPTABLES Rules

If you are running IPTABLES in your Server then you need to allow Port 443 from that as well using below iptables command. You can check 30 Most Popular IPTABLES command in Linux to know more about iptables.

[root@localhost ~]# iptables -A INPUT -p tcp --dport 443 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT
[root@localhost ~]# iptables -A OUTPUT -p tcp --sport 443 -m conntrack --ctstate ESTABLISHED -j ACCEPT

Step 9: Restart httpd service and Check the Status

Now we can again try to restart the httpd service using service httpd restart command and check if this helps.

[root@localhost ~]# service httpd restart
Redirecting to /bin/systemctl restart httpd.service

This time we do not see any error on the output, so let’s check the httpd service status again by using service httpd status command. Here we can see that service is now started successfully without any error.

[root@localhost ~]# service httpd status
Redirecting to /bin/systemctl status httpd.service
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
Active: active (running) since Wed 2020-10-14 06:29:14 EDT; 8s ago
Docs: man:httpd(8)
man:apachectl(8)
Main PID: 6902 (httpd)
Status: "Processing requests..."
CGroup: /system.slice/httpd.service
├─6902 /usr/sbin/httpd -DFOREGROUND
├─6903 /usr/sbin/httpd -DFOREGROUND
├─6904 /usr/sbin/httpd -DFOREGROUND
├─6905 /usr/sbin/httpd -DFOREGROUND
├─6906 /usr/sbin/httpd -DFOREGROUND
└─6907 /usr/sbin/httpd -DFOREGROUND

Oct 14 06:29:14 localhost.localdomain systemd[1]: Starting The Apache HTTP Server...
Oct 14 06:29:14 localhost.localdomain systemd[1]: Started The Apache HTTP Server.

Hopefully you found this article useful in resolving "AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message" error.

Popular Recommendations:-

How to Install PHP on RedHat/CentOS 7 with Easy Steps

Useful C Program to List Network Interfaces using only 30 Lines of Code

Best Explanation of Wrapper Classes in Java: Autoboxing and Unboxing with Examples

5 Best Ways to Become root user or Superuser in Linux (RHEL/CentOS/Ubuntu)

7 Easy Steps to Install PHP on RHEL 8/CentOS 8

Easy Steps to Install Java on Ubuntu 20.04

Best Steps to Install Java on RHEL 8/CentOS 8

15 ansible-vault command examples to encrypt and decrypt sensitive data/files on Linux

When you are starting Apache server, you might get the AH00557 and AH00558 warning message as shown below.

# /usr/local/apache2/bin/apachectl start
AH00557: httpd: apr_sockaddr_info_get() failed for dev-server
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message
Apache/2.4.2 mod_ssl (Pass Phrase Dialog)
Some of your private key files are encrypted for security reasons.
In order to read them you have to provide the pass phrases.
Server www.example.com:443 (RSA)
Enter pass phrase:
OK: Pass Phrase Dialog successful.

You’ll also get the same warning message even when you stop the Apache HTTPD server as shown below.

# /usr/local/apache2/bin/apachectl stop
AH00557: httpd: apr_sockaddr_info_get() failed for dev-server
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message

If you are using service httpd to stop and start, you ‘ll get the similar warning message.

# service httpd start
Starting httpd: httpd: apr_sockaddr_info_get() failed for dev-server
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName

To fix the above warning message, add the “ServerName” directive to the httpd.conf file accordingly.

# vi /usr/local/apache2/conf/httpd.conf
ServerName 192.168.1.2

Note: Depending on how your are planning to setup the Apache, the above ServerName directive can either be a hostname, or ip-address, or fully qualified domain name. If you are just running the Apache for internal testing purpose, you can simply set it to the ip-address of the server.

If you want to use hostname in the httpd.conf file, make sure you also have a corresponding entry in the /etc/hosts file for that hostname as shown below.

# vi /usr/local/apache2/conf/httpd.conf
ServerName dev-server

# vi /etc/hosts
127.0.0.1   dev-server localhost.localdomain localhost

Now when you start the apache again, you’ll not get the warning message anymore.

# service httpd stop
Stopping httpd:    [  OK  ]

I installed apache2 on ubuntu 13.10.
If I try to restart it using

sudo /etc/init.d/apache2 restart

I get this message:

AH00558: apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1. Set the ‘ServerName’ directive globally to suppress this message

So I read that I should edit my httpd.conf file. But, since I can’t find it in /etc/apache2/ folder, I tried to locate it using this command:

/usr/sbin/apache2 -V

But the output I get is this:

[Fri Nov 29 17:35:43.942472 2013] [core:warn] [pid 14655] AH00111: Config variable ${APACHE_LOCK_DIR} is not defined
[Fri Nov 29 17:35:43.942560 2013] [core:warn] [pid 14655] AH00111: Config variable ${APACHE_PID_FILE} is not defined
[Fri Nov 29 17:35:43.942602 2013] [core:warn] [pid 14655] AH00111: Config variable ${APACHE_RUN_USER} is not defined
[Fri Nov 29 17:35:43.942613 2013] [core:warn] [pid 14655] AH00111: Config variable ${APACHE_RUN_GROUP} is not defined
[Fri Nov 29 17:35:43.942627 2013] [core:warn] [pid 14655] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Fri Nov 29 17:35:43.947913 2013] [core:warn] [pid 14655] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Fri Nov 29 17:35:43.948051 2013] [core:warn] [pid 14655] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Fri Nov 29 17:35:43.948075 2013] [core:warn] [pid 14655] AH00111: Config variable ${APACHE_LOG_DIR} is not defined

AH00526: Syntax error on line 74 of /etc/apache2/apache2.conf:
Invalid Mutex directory in argument file:${APACHE_LOCK_DIR}

Line 74 of /etc/apache2/apache2.conf is this:

Mutex file:${APACHE_LOCK_DIR} default

I gave a look at my /etc/apache2/envvar file, but I don’t know what to do with it.

What should I do?

asked Nov 29, 2013 at 16:49

Kurt Bourbaki's user avatar

Kurt BourbakiKurt Bourbaki

8931 gold badge6 silver badges7 bronze badges

1

[Fri Nov 29 17:35:43.942472 2013] [core:warn] [pid 14655] AH00111: Config variable ${APACHE_LOCK_DIR} is not defined

This message is displayed because you directly executed the apache2 binary.
In Ubuntu/Debian the apache config relies on the envvar file which is only activated.

If you start apache with the init script or apachectl.

Your original problem is that you have no a proper hostname (fqdn) for your machine.

If you can’t change it, change the ServerName variable in /etc/apache2/apache2.conf to localhost or your prefered FQDN.

simhumileco's user avatar

answered Nov 29, 2013 at 17:50

ah83's user avatar

ah83ah83

1,0829 silver badges8 bronze badges

8

Source your envvars by running it like this:

source /etc/apache2/envvars

and then

/usr/sbin/apache2 -V

You should get:

el@apollo:/home/el$ apache2 -V
Server version: Apache/2.4.7 (Ubuntu)
Server built:   Apr  3 2014 12:20:28
Server's Module Magic Number: 20120211:27
Server loaded:  APR 1.5.1-dev, APR-UTIL 1.5.3
Compiled using: APR 1.5.1-dev, APR-UTIL 1.5.3
Architecture:   64-bit
Server MPM:     prefork
  threaded:     no
    forked:     yes (variable process count)
Server compiled with....
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -D APR_USE_SYSVSEM_SERIALIZE
 -D APR_USE_PTHREAD_SERIALIZE
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D DYNAMIC_MODULE_LIMIT=256
 -D HTTPD_ROOT="/etc/apache2"
 -D SUEXEC_BIN="/usr/lib/apache2/suexec"
 -D DEFAULT_PIDLOG="/var/run/apache2.pid"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="mime.types"
 -D SERVER_CONFIG_FILE="apache2.conf"

Fritz's user avatar

answered Jun 28, 2014 at 10:51

nadavkav's user avatar

nadavkavnadavkav

1,4891 gold badge11 silver badges6 bronze badges

7

Check your /etc/apache2/envvars for the APACHE_LOCK_DIR. In my Ubuntu 12.04, this is /var/lock/apache2$SUFFIX, being SUFFIX normally empty.

Check if the directory exists and is writable.

May it be that the envvars file is not sourced correctly? If you have a look at /etc/init.d/apache2 you can see that it sourced.

My (default) /etc/apache2/envvars:

# envvars - default environment variables for apache2ctl

# this won't be correct after changing uid
unset HOME

# for supporting multiple apache2 instances
if [ "${APACHE_CONFDIR##/etc/apache2-}" != "${APACHE_CONFDIR}" ] ; then
    SUFFIX="-${APACHE_CONFDIR##/etc/apache2-}"
else
    SUFFIX=
fi

# Since there is no sane way to get the parsed apache2 config in scripts, some
# settings are defined via environment variables and then used in apache2ctl,
# /etc/init.d/apache2, /etc/logrotate.d/apache2, etc.
export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data
export APACHE_PID_FILE=/var/run/apache2$SUFFIX.pid
export APACHE_RUN_DIR=/var/run/apache2$SUFFIX
export APACHE_LOCK_DIR=/var/lock/apache2$SUFFIX
# Only /var/log/apache2 is handled by /etc/logrotate.d/apache2.
export APACHE_LOG_DIR=/var/log/apache2$SUFFIX

## The locale used by some modules like mod_dav
export LANG=C
## Uncomment the following line to use the system default locale instead:
#. /etc/default/locale

export LANG

## The command to get the status for 'apache2ctl status'.
## Some packages providing 'www-browser' need '--dump' instead of '-dump'.
#export APACHE_LYNX='www-browser -dump'

## If you need a higher file descriptor limit, uncomment and adjust the
## following line (default is 8192):
#APACHE_ULIMIT_MAX_FILES='ulimit -n 65536'

If nothing works I would try to reinstall the package(s).

answered Nov 29, 2013 at 17:49

erny's user avatar

ernyerny

3511 silver badge7 bronze badges

0

As other said, you have to load (source) your environment before running it directly
Another option is to use:
apache2ctl e.g.

sudo apache2ctl -S

to dump my hosts

answered Feb 24, 2015 at 22:38

amd's user avatar

TL;DR; You should start apache2 using what you already have:

sudo /etc/init.d/apache2 {start|stop|restart}

Detailed:

AH00558: apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1. Set the ‘ServerName’ directive globally to suppress this message

This message means you need to define your server name / domain name. It’s not essential to do it for a localhost/testing of production, you don’t need to worry about it.

When you try to run it the other way, using only apache2, you’ll get those error messages because of what was said before: the environment variables are defined when you start using the default script in init.d.

answered Jun 2, 2016 at 11:07

George's user avatar

GeorgeGeorge

1214 bronze badges

This works for me

sudo -u root bash -c "source /etc/apache2/envvars; apache2 -V"

answered Jun 6, 2016 at 8:15

Lihnjo's user avatar

1

Maybe this will resolve your problem

sudo bash -c '. /etc/apache2/envvars ; apache2'

answered Apr 13, 2016 at 14:44

Eugen Konkov's user avatar

Eugen KonkovEugen Konkov

1961 gold badge2 silver badges13 bronze badges

1

You need to update the DocumentRoot from /var/www/html to /var/www

Edit the file /etc/apache2/sites-available/000-default.conf as follows

DocumentRoot /var/www

Drew Khoury's user avatar

Drew Khoury

4,6278 gold badges26 silver badges28 bronze badges

answered May 12, 2014 at 10:31

user219404's user avatar

Like this post? Please share to your friends:
  • Age of wonders 3 error loading profile
  • Age of empires 3 error 0003 could not compile file ailoaderstandard xs
  • Age of empires 2 hd edition как изменить разрешение экрана
  • Agcinvokerutility exe ошибочный образ
  • Age of mythology как изменить разрешение экрана