Blurocket9
Blurocket9

Reputation: 71

Getting message AH00558: apache2:

Restarting web server apache2
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

I am a newby installing Ubuntu Can someone help on the commands I need to set this up? I already tried vim /etc/apache2/apache2.conf and adding localhost but I am still getting message when I restart Apache2 server.

Upvotes: 7

Views: 29072

Answers (4)

Fithe_Xanki
Fithe_Xanki

Reputation: 107

Your can use the commands for errors and which services are running. I'll try using journalctl -u httpd.service and check if it's there based on the results. I know this was just a quick example in the localhost case and it works. But we all know that less experienced users can take advice literally and end up with, say, a sub-optimal or dangerous setting. This must always be remembered, therefore use the following: the ServerName directive allows your to use different domain names localhost user-desktop 127.0.0.1 127.0.1.1 without errors for /etc/apache2/apache2.conf after the line # vim: syntax=apache ts=4 sw=4 sts=4 sr noet at the end of the file.

sudo journalctl -u apache2.service --since today --no-pager
sudo journalctl -u httpd.service --since today --no-pager
sudo systemctl status apache2.service -l --no-pager
sudo systemctl status httpd.service -l --no-pager
sudo tail -10 /var/log/apache2/access.log
sudo tail -10 /var/log/apache2/error.log

Upvotes: 1

Ashish Panwar
Ashish Panwar

Reputation: 11

Add below tag in your configuration file and try

ServerName localhost

Upvotes: 1

kenorb
kenorb

Reputation: 166399

Run the following command:

apachectl -t -D DUMP_INCLUDES

to determine path to your httpd.conf configuration file, then edit that file and uncomment (or add) line which should specify value for ServerName option, e.g.

ServerName localhost

For the web server, use the registered DNS name (e.g. example.com).

If your host doesn't have a registered DNS name, enter its IP address here.

Then restart your Apache as usual, e.g. apachectl graceful.

Upvotes: 6

Denis Komnenovic
Denis Komnenovic

Reputation: 113

Fast but not so elegant solution:

Navigate to the file - apache2.conf, i would use a terminal, here the steps:

  1. cd /etc/apache2/

    2.vim apache2.conf ( or pluma apache2.conf, if you are not a vi-geek )

  2. Write on the bottom:

    • ServerName localhost
  3. Save the file and restart apache, with following commands in the terminal:

    • /etc/init.d/apache2 restart You can use some UI or other commands like "service apache2 restart".

Just for the case, you can make a check, to see ether this directive isn't just disabled in some of the configuration files:

  • grep -inRH "ServerName " /etc/apache2/ | grep "\s#"*

Now the error is gone. You need root-rights for all this steps or use "sudo" instead.

Hope i could help you. Cheers.

Upvotes: 11

Related Questions