Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am on Ubuntu 12.04 box, recently installed one apache2 update, and since then all the virtual hosts are not pointing to the correct directories, it's now pointing to the default localhost. Also I am getting an error on apache2 restart:

shafox@shafox:~$ sudo /etc/init.d/apache2 restart
* Restarting web server apache2 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 [ OK ]. 

I know I haven't set up the servername is not localhost, but why there is a AH00558 stamp before the error message? This is my sites-available in my system:

/etc/apache2/sites-available$ ls
000-default.conf       default-ssl.conf  localbox-local
000-default.conf.dpkg-new  devbox-dev        sites-si

Previously it was like this:

/etc/apache2/sites-available$ ls
000-default  default-ssl  localbox-local  devbox-dev   sites-si

For example one of the virtual host file looks like this:

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        ServerName localbox.local
        DocumentRoot /home/shafox/Localbox
        <Directory />
                Options FollowSymLinks
                AllowOverride All
        </Directory>
        <Directory /home/shafox/Localbox/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog ${APACHE_LOG_DIR}/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>

I don't want to create all these virtual hosts again. I have followed the steps written in this tutorial to create all these virtual hosts.

Here is my /etc/hosts file:

127.0.0.1       localhost
127.0.1.1       shafox
127.0.1.1       devbox.dev
127.0.1.1       localbox.local
127.0.1.1       sites.si

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

Error logs from the apache2 error.log Error Log Link

share|improve this question

3 Answers 3

up vote 1 down vote accepted

That is not technically an "error"... but it is a warning. Previous init.d scripts would simply put that warning into the logs, and report nothing when restarting. The message is accurate in that Apache has no way to identify the server's fqdn based on the information available. You could simply add to the loopback interface entry in the hosts file like this:

127.0.1.1       servername server.fully.qualified.name.tld

or specify the ServerName directive as the warning suggests in the apache.conf:

ServerName www.example.com

Also, if you've decided to use ubuntu, you really should use the upstart commands to control services like apache instead of the init.d scripts. Like this:

sudo restart apache2
share|improve this answer
    
I have used the sudo service restart apache2 but with that warning. But the virtual hosts are not pointing the correct dir. I have set up the hosts file to point to the servername lemme update my question with the hosts file also. –  Pranaya Behera Aug 3 '13 at 7:21
    
AH00558 is simply a message-identifier from apache. Think of it as an "error code". It looks like when the updated package was installed, the "default" site was replaced. You may need to remove the 000-default.conf.dpkg-new and replace the symlink to the original 000-default.conf. (look in sites-enabled rather than sites-available) –  TheCompWiz Aug 3 '13 at 7:26
    
Yeah it was not present previously the 000-default.conf.dpkg-new . Do I have to remove this file and then update the contents to the 000-default.conf ? –  Pranaya Behera Aug 3 '13 at 7:28
    
No. sites-available are simply confs that could be enabled by using the a2ensite command. Look in the sites-enabled directory for confs that are actually loaded. –  TheCompWiz Aug 3 '13 at 7:28
    
You might also want to check the apache logs or syslog for errors during startup. –  TheCompWiz Aug 3 '13 at 7:29

I had the same problem after upgrading to Apache 2.4 for a Drupal multisite dev system. The mod_rewrite did not work at all. The key was the directive in the virtual host file:

<Directory /whatever-path/>
  Options Indexes FollowSymLinks
  AllowOverride All
  Require all granted
</Directory>

Note the AllowOverride All and Require all granted which is different from Apache 2.2

Hope this helps.

share|improve this answer
    
so by adding Require All Granted will resolve the issue ? –  Pranaya Behera Aug 4 '13 at 4:08
    
@PranayaBehera - sorry for the delayed reply -- my dev sys is a win/ubuntu dual boot, drupal multsite configuration behind a firewall, blah, blah, blah. I just want things to work. YMMV. –  Diogenes van Sinope Aug 15 '13 at 8:14
    
@PranayaBehera LOL - tried to edit the above post, but you only have 5 minutes to do this. It's like a speed date. I wanted to add that 'Require All Granted' probably sucks in a security context YMMV. –  Diogenes van Sinope Aug 15 '13 at 8:27

I also had this problem, but solved it using same answer as Diogenes. To be specific there is syntax being replaced.

from https://httpd.apache.org/docs/trunk/upgrading.html

In this example, all requests are denied.

2.2 configuration: Order deny,allow Deny from all

2.4 configuration: Require all denied

In this example, all requests are allowed.

2.2 configuration: Order allow,deny Allow from all

2.4 configuration: Require all granted

In the following example, all hosts in the example.org domain are allowed access; all other hosts are denied access.

2.2 configuration: Order Deny,Allow Deny from all Allow from example.org

2.4 configuration: Require host example.org

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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