I got stuck with an issue where I am getting this error on my screen.
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
Here are 2 ways to fix this issue, Generally, I got only 1 solution that was obviously not working in my case and available easily over the internet. I believe everyone has their own setup manual followed as per their requirements and the system setup is also not a big deal if you have some technical knowledge about the packages and codes.
Solution 1:
Edit Apache config file
sudo nano /etc/apache2/apache2.conf
And after # Global configuration, just add this line:
ServerName localhost
and then restart apache:
sudo systemctl reload apache2
Solution 2:
Sometimes this issue is not with the apache file configuration edits and I also strongly not recommending taht approach. In my case, the issue was with the current PHP FPM package was disabled.
If you have multiple PHP version packages installed on your system then it might the solution for your issue.
Note: I used PHP8.0, but your PHP version might be different. Please use your required PHP version along with the commands below.
To easily switch between your installed PHP version follow this link How to switch PHP versions in Linux ubuntu
Check the current PHP-FPM service for your currently active PHP.
sudo systemctl status php8.0-fpm
then, enable this by using this command:
sudo a2enconf php8.0-fpm
Restart or reload apache:
sudo systemctl restart apache2
Now, your issue has been fixed.
You can get more details about this topic from here.
To check more articles related to this topic, please check related posts here.