Restarting Apache Server - Ubuntu

Posted February 11, 2015 82.1k views

I tried to restart

It says “Could not reliably determine the server’s fully qualified domain name. Using 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.


These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
7 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

when i run sudo service apache2 restart i got below erroe

Job for apache2.service failed because the control process exited with error code. See “systemctl status apache2.service” and “journalctl -xe” for details.

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

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