Start a conversation

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

The ‘yum’ package manager can be used to Install the Apache web server on a Fedora web server. Known for it flexibility and stability, Apache is considered to be one of the highly popular and widely used web-servers in the Industry. There isn’t a web server that hosts more websites than what Apache does. Moreover, finding support for it is just meters away, one can find a number of tutorials on this topic over the World Wide Web.
The information offered below would help users understand the steps to get rid of the warning :

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

To initiate the process, we’d first check the iptables

You need to be careful with the primary step ie. before you install a web server. This is to ensure that the browser is capable of reaching it.

Usually, if you have a firewall running on a server, it may carry out its task of blocking traffic to ports 80 and 443 which are usually used for regular and secure connections respectively. So, you must first check the firewall rules using the below command :

sudo /sbin/iptables -L

Check whether the ports 80 and 443 are open. Well, if you do not have a firewall installed on a web hosting server yet, there is no question of making any changes to it.

If you find that the ports are closed the following rules should be set in iptables configuration:

iptables -I INPUT -p tcp –dport 80 -m state –state NEW,ESTABLISHED -j ACCEPT
iptables -I OUTPUT -p tcp –sport 80 -m state –state ESTABLISHED -j ACCEPT
iptables -I INPUT -p tcp –dport 443 -m state –state NEW,ESTABLISHED -j ACCEPT
iptables -I OUTPUT -p tcp –sport 443 -m state –state ESTABLISHED -j ACCEPT

How to Install Apache on Fedora ?

The procedure to Install a basic apache is simple, use the following command for the same :

sudo yum install httpd mod_ssl

This command would install apache and couple other packages to support few of the required option.

Setting the ServerName

You may probably encounter a warning such as “httpd: Could not reliably determine the server’s fully qualified domain name, using 127.0.0.1 for ServerName”. Such a warning is usually shown by “httpd” as it is a default name of an apache process when it’s running, therefore you must look for in a ps list or top.

To get past this warning you are first of all required to create a “custom” directory in apache’s configuration directory. The following command should help you do that :

sudo mkdir /etc/httpd/conf/custom

Now create a config file to store your server name:

sudo nano /etc/httpd/conf/custom/preferredserver_name.conf

You must now include the below line into the servername.conf file

ServerName preferredserver_name

NOTE : You must replace the “preferredserver_name” with the name of your choice. Make sure that you do not use domain name as we’d be using it to create virtual hosts later.

Then, you must save the file.

Now, make amendments to the the main apache config file, use the following command to access it:

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

Scroll down to the end and insert the below code:

Include /etc/httpd/conf/custom/*.conf

Save the changes made to httpd.conf.

This completes the installation of apache.

Use the below command to start automatically upon reboot.

sudo /sbin/chkconfig httpd on

Make sure that the ServerName is included in the httpd.conf file and the host name is correctly specified:

hostname preferredserver_name

Once the server is Rebooted, you shouldn’t see the Warning message again.

Choose files or drag and drop files
Was this article helpful?
Yes
No
  1. Diya Ahmed

  2. Posted

Comments