Restarting Apache Server - Ubuntu

February 11, 2015 66.9k views

I tried to restart

It says “Could not reliably determine the server’s fully qualified domain name. Using 127.0.0.1. Set the ‘Servername’ directive globally to suppress this message ”.

I haven’t pointed any domain to my IP yet. I am trying to restart apache is because of minor changes in php.ini file.

How can I restart apache2 successfully ? or How to make php.ini changes to work.

3 comments
6 Answers

To fix that problem, you need to create an httpd.conf file.

From the terminal:
sudo nano /etc/apache2/httpd.conf
the file will be blank…add the following line:

ServerName localhost

Save the file and exit nano.(I think it is crtrl X in nano)

Finally restart the server.:
sudo service apache2 restart

Just had the same issue, resolved it by following sierracircle’s instructions except that I edited this file:

sudo nano /etc/apache2/apache2.conf

Hmm, that did not work for me. I tried localhost, the IP address of my server, and the domain for that server. No luck.

  • echo “ServerName YOUR SEVER IP” | sudo tee /etc/apache2/conf-available/fqdn.conf && sudo a2enconf fqdn

I’m wondering if sierracircle isn’t being specif enough about the apache directive ServerName. Does it need to be in some sort of xml block or something?

how to restart server?

sudo service apache2 restart

Have another answer? Share your knowledge.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!