Horje
How to fix "Could not reliably determine the server’s fully qualified domain name" warning in Apache?

When setting up Apache on a server we may have the warning “Could not reliably determine the server’s fully qualified domain name.” This warning typically appears when Apache is started or restarted. It doesn’t necessarily indicate a critical issue but it’s important to understand and resolve it to ensure proper server configuration.

Problem Statement

Upon starting or restarting Apache, we get the following warning message:

dse1

AH00558: apache2: Could not reliably determine the server’s fully qualified domain name using the 127.0.1.1. Set the ‘ServerName’ directive globally to suppress this message. This warning indicates that Apache cannot determine the fully qualified domain name (FQDN) of the server.

Set ServerName in httpd.conf or apache2.conf

Edit the Apache configuration file. Add or update the ServerName directive to specify the server’s FQDN. This can be set globally to suppress the warning message.

Example:

ServerName example.com
  • Replace example.com with the actual domain name.

Code:

sudo nano /etc/apache2/apache2.conf# Set ServerName directive globallyServerName example.com

Output:

  • After saving the changes, restart Apache to the apply the configuration:
sudo systemctl restart apache2
  • Verify the Apache configuration for the any syntax errors:
sudo apache2ctl configtest
  • If no errors are reported, the warning should be resolved the upon restarting Apache.

Use IP Address in ServerName

  • Alternatively, if we prefer, we can use the server’s IP address instead of the domain name.
ServerName 192.168.1.1
  • Replace 192.168.1.1 with the server’s actual IP address.

Code:

sudo nano /etc/apache2/apache2.conf
# Set ServerName directive with IP address
ServerName 192.168.1.1

Output:

  • Save the changes and restart Apache:
sudo systemctl restart apache2
  • Verify the configuration:
sudo apache2ctl configtest

Conclusion

By setting the ServerName directive in Apache’s configuration file we can resolve the warning about not being able to the determine the server’s fully qualified domain name. This ensures proper server configuration and eliminates unnecessary warning messages during the Apache startup or restart.




Reffered: https://www.geeksforgeeks.org


Web Technologies

Related
E-commerce Websites : Product Detail Page E-commerce Websites : Product Detail Page
E-commerce Websites : Backend Setup E-commerce Websites : Backend Setup
E-commerce Web App : Product Listing E-commerce Web App : Product Listing
How To Use Apache as a Reverse-Proxy with mod_proxy on Ubuntu 20.04? How To Use Apache as a Reverse-Proxy with mod_proxy on Ubuntu 20.04?
How to Use Font Awesome On Your WordPress Website? How to Use Font Awesome On Your WordPress Website?

Type:
Geek
Category:
Coding
Sub Category:
Tutorial
Uploaded by:
Admin
Views:
15