How to configure the fully qualified domain name of the server?

When I try to restart the apache release / etc / init.d / apache2 restart, I get the following messages:

root@server :~# /etc/init.d/apache2 restart * Restarting web server apache2 apache2: apr_sockaddr_info_get() failed for server apache2: Could not reliably determine the server fully qualified domain name, using 127.0.0.1 for ServerName ... waiting apache2: apr_sockaddr_info_get() failed for server apache2: Could not reliably determine the server fully qualified domain name, using 127.0.0.1 for ServerName [ OK ] root@server :~# cat /etc/hostname iSell root@server :~# hostname server root@server :~# hostname -f hostname: Name or service not known root@server :~# cat /etc/hosts 127.0.0.1 localhost localhost.localdomain 108.1.*.* eins root@server :~# 

Note: two asterisks at the end of ip in / etc / hosts were added by me at the time of publication. Note2: let's say my domain name is: www.xyz.net

I would like to know exactly what I should do step by step, please. Many thanks!

+7
source share
5 answers

Just edit the empty httpd.conf for Apache with the following:

 sudo gedit /etc/apache2/httpd.conf 

Add a line:

 ServerName localhost 

Save and exit and restart Apache:

 sudo /etc/init.d/apache2 restart 

This will take care of it.

+21
source

1) Edit the file: vi / etc / apache2 / apache.conf 2) Write in the last line (to see your computer name: cat / etc / hostname): Server_name is the name of your machine 3) restart the apache2 service

enjoyit!

+1
source
  • First check your apache version
    $ apache2 -v
  • If your apache version is 2.x, use the following command to avoid this message.
    $ echo "ServerName\t`cat /etc/hostname`" | sudo tee -a /etc/apache2/apache2.conf
+1
source

Add server_name to /etc/apache2/apache.conf :

 ServerName [yourservername or localhost] 

and download apache configuration: service apache2 restart

+1
source

Edit Host File

 sudo nano /etc/hosts 

look if you ip 127.0.1.1 as a good server name

 127.0.1.1 srv-web-01 

and restart apache

 sudo service apache2 restart 
0
source

All Articles