Apache cannot fully determine domain name when I tried restarting after install.

I get this error;

sudo /etc/init.d/apache2 restart

*Restarting web server config apache2

apache2: Could not reliably determine the server's fully qualified domain name, using for ServerName.

Why I'm I seeing I have tried saving ServerName localhost into my /etc/init.d/apache2 but it keeps redirecting me to google search page everytime I type phpmyadmin.

Will appreciate an expert help?


Unless there is a specific reason you need it to determine it there is no real reason to try and do so. I run 3 soon to be 5 sites on my server and at every restart it still says that. It seems to only be important in very specific cases.


You need to specify ( Optional ) name of the site in apache configuration. Edit /etc/apache2/httpd.conf file.

Add following parameter

Servername <your-website-name> 

For example

 Servername ketan.in

Restart apache

/etc/init.d/apache2 restart 

As default the configurations of apache is blank. Try to set with this.

Open terminal, and edit /etc/apache2/httpd.conf ,

set Servername localhost

Besure u have changed httpd.conf with right.

Restart with this command :

sudo service apache2 stop

sudo service apache2 start

See image below.

enter image description here

enter image description here

enter image description here

  • Thanks for the detailed response, I've tried that approach with no success could it be because of this command I inputted? sudo ln -s /usr/share/phpmyadmin /var/www/phpmyadmin Is this an accurate command? Thanks. – frqcuse Feb 26 '13 at 6:51
  • The command u input :sudo ln -s /usr/share/phpmyadmin /var/www/phpmyadmin not related with ur problem, because ur command just fix phpmyadmin so u can access from localhost right? I think u must remove apache and friends first and install again. Using this command: sudo apt-get remove apache2 php5 phpmyadmin and install again using this: sudo apt-get install apache2 php5 php5-mysql phpmyadmin – Baim Feb 26 '13 at 9:48
  • This is what happens when I tried to reinstall; sudo apt-get remove apache2 php5 phpmyadmin Reading package lists... Done Building dependency tree Reading state information... Done Package apache2 is not installed, so not removed Package php5 is not installed, so not removed Package phpmyadmin is not installed, so not removed The following packages were automatically installed and are no longer required: php5-gd libmcrypt4 php5-mcrypt apache2-mpm-worker dbconfig-common Use 'apt-get autoremove' to remove them. Not sure why it can't let me reinstall. – frqcuse Feb 26 '13 at 16:38


ServerName localhost

should be added to /etc/apache2/httpd.conf or to some specific site in /etc/apache2/sites-available/. The configuration can vary on different versions but httpd.conf should be there always.

  • It is not working still redirecting to google. – frqcuse Feb 26 '13 at 6:25
  • Did it still give a warning while restarting apache2? Did you explicitly add http to beginning? localhost ? (Chrome is at least trying to be "smart" sometimes). Does work? – Kride Feb 26 '13 at 6:28
  • Did not work? Still fighting with it. – frqcuse Feb 26 '13 at 6:52
  • If even doesn't work, then there's something else wrong with configuration. How did you install the apache2? – Kride Feb 26 '13 at 7:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.