Find the answer to your Linux question:
Page 1 of 3 1 2 3 LastLast
Results 1 to 10 of 27
I want to use the domain name, but it gets ignored by apache2 server. As result, I cannot access my webpage. Here is an error: Code: root[at]Debian-60-squeeze-64-minimal:~# /etc/init.d/apache2 restart Restarting ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Aug 2012
    Posts
    11

    Question apache2 server ignores the domain name


    I want to use the domain name, but it gets ignored by apache2 server.
    As result, I cannot access my webpage.

    Here is an error:

    Code:
    root[at]Debian-60-squeeze-64-minimal:~# /etc/init.d/apache2 restart
    Restarting web server: apache2[Tue Aug 21 15:12:02 2012] [error] (EAI 2)Name or service not known: Could not resolve host name *;80 -- ignoring!
    [Tue Aug 21 15:12:02 2012] [error] (EAI 2)Name or service not known: Could not resolve host name *;80 -- ignoring!
    apache2: Could not reliably determine the server's fully qualified domain name, using IP-address for ServerName
    *... waiting [Tue Aug 21 15:12:03 2012] [error] (EAI 2)Name or service not known: Could not resolve host name *;80 -- ignoring!
    [Tue Aug 21 15:12:03 2012] [error] (EAI 2)Name or service not known: Could not resolve host name *;80 -- ignoring!
    apache2: Could not reliably determine the server's fully qualified domain name, using IP-address for ServerName
    /etc/apache2/sites-enabled/mysite text file contains the following:

    Code:
    <VirtualHost *;80>
       ServerName mysitecom
       ServerAlias mysitecom
       DocumentRoot /var/www/mysite
    </VirtualHost>
    
    <VirtualHost *;80>
       ServerName wwwmysitecom
       ServerAlias wwwmysitecom
       DocumentRoot /var/www/mysite
    </VirtualHost>
    httр.conf file is empty
    Last edited by black_penguin; 08-21-2012 at 03:29 PM.

  2. #2
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    are those semi-colons?

    Code:
    <VirtualHost *;80>
    change them to colons, e.g.:

    Code:
    <VirtualHost *:80>

  3. #3
    Just Joined!
    Join Date
    Aug 2012
    Posts
    11
    Quote Originally Posted by atreyu View Post
    are those semi-colons?

    Code:
    <VirtualHost *;80>
    change them to colons, e.g.:

    Code:
    <VirtualHost *:80>
    Thank you. Already fixed many errors.
    Now apache2 starts normally, but I still cannot access the website using domain name.
    During launch, apache2 outputs the following:
    Code:
    root@Debian-60-squeeze-64-minimal:~# service apache2 restart
    Restarting web server: apache2apache2: Could not reliably determine the server's fully qualified domain name, using 178.63.95.207 for ServerName
     ... waiting apache2: Could not reliably determine the server's fully qualified domain name, using 178.63.95.207 for ServerName
    .

  4. #4
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    Are the hostnames you've defined in your virtualHosts section (e.g., wwwmysitecom, mysitecom) resolvable to an IP address? If they are not valid DNS entries (or you're not using DNS), you can simply add entries for them in /etc/hosts, pointing to your local ip address. assuming it is the ip address listed in the above apache error, you could put:

    Code:
    178.63.95.207    <local_hostname> wwwmysitecom mysitecom
    for <local_hostname>, just substitute whatever is your real hostname (i.e., the output of the hostname command).

    also, in your httpd.conf file you can define ServerName with the loopback ip address (127.0.0.1).

    After changes, restart the apache server.

  5. #5
    Linux Engineer
    Join Date
    Apr 2012
    Location
    Virginia, USA
    Posts
    896
    I believe apache2.conf is the default config file for debian.

  6. #6
    Just Joined!
    Join Date
    Aug 2012
    Posts
    11
    Quote Originally Posted by atreyu View Post
    Are the hostnames you've defined in your virtualHosts section (e.g., wwwmysitecom, mysitecom) resolvable to an IP address? If they are not valid DNS entries (or you're not using DNS), you can simply add entries for them in /etc/hosts, pointing to your local ip address. assuming it is the ip address listed in the above apache error, you could put:

    Code:
    178.63.95.207    <local_hostname> wwwmysitecom mysitecom
    for <local_hostname>, just substitute whatever is your real hostname (i.e., the output of the hostname command).

    also, in your httpd.conf file you can define ServerName with the loopback ip address (127.0.0.1).

    After changes, restart the apache server.
    I have already tried the following. But the error does not disappear:
    Code:
    Could not reliably determine the server's fully qualified domain name, using 178.63.95.207 for ServerName

  7. #7
    Penguin of trust elija's Avatar
    Join Date
    Jul 2004
    Location
    Either at home or at work or down the pub
    Posts
    3,569
    Run
    Code:
    hostname
    on the server and then edit your apache config file and add
    Code:
    ServerName OUTPUT FROM THE hostname COMMAND HERE
    to get rid of that message, although it shouldn't actually stop Apache from starting.
    Last edited by elija; 08-23-2012 at 11:35 AM. Reason: Removing chevrons as they could be confusing
    What do we want?
    Time machines!

    When do we want 'em?
    Doesn't really matter does it!?


    The Fifth Continent

  8. #8
    Just Joined!
    Join Date
    Aug 2012
    Posts
    11
    Quote Originally Posted by elija View Post
    Run
    Code:
    hostname
    on the server and then edit your apache config file and add
    Code:
    ServerName OUTPUT FROM THE hostname COMMAND HERE
    to get rid of that message, although it shouldn't actually stop Apache from starting.
    Unfortunately, that doesnt work. My hostname is Debian-60-squeeze-64-minimal

  9. #9
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    Quote Originally Posted by black_penguin View Post
    Unfortunately, that doesnt work. My hostname is Debian-60-squeeze-64-minimal
    and is Debian-60-squeeze-64-minimal resolvable to an ip address (in /etc/hosts or DNS)?

    which apache config file are you editing? can you display it's path and maybe also post it? are your virtualhost declarations in the same file? post those too, if not in the default config file.
    Last edited by atreyu; 08-23-2012 at 10:44 PM. Reason: format

  10. #10
    Just Joined!
    Join Date
    Aug 2012
    Posts
    11
    Quote Originally Posted by atreyu View Post
    and is Debian-60-squeeze-64-minimal resolvable to an ip address (in /etc/hosts or DNS)?

    which apache config file are you editing? can you display it's path and maybe also post it? are your virtualhost declarations in the same file? post those too, if not in the default config file.
    /etc/hosts file:

    Code:
    ### Hetzner Online AG installimage
    # nameserver config
    # IPv4
    
    # ServerName Debian-60-squeeze-64-minimal
    
    127.0.0.1 targetcraft
    178.63.95.207  Debian-60-squeeze-64-minimal
    #
    # IPv6
    ::1 ip6-localhost ip6-loopback
    fe00::0 ip6-localnet
    ff00::0 ip6-mcastprefix
    ff02::1 ip6-allnodes
    ff02::2 ip6-allrouters
    ff02::3 ip6-allhosts
    Virtual hosts declarations could be seen in /etc/apache2/sites-available/mysite text file:

    Code:
    <VirtualHost *;80>
       ServerName mysitecom
       ServerAlias mysitecom
       DocumentRoot /var/www/mysite
    </VirtualHost>
    
    <VirtualHost *;80>
       ServerName wwwmysitecom
       ServerAlias wwwmysitecom
       DocumentRoot /var/www/mysite
    </VirtualHost>
    /etc/apache2/sites-enabled/mysite is the link to previous text file

Page 1 of 3 1 2 3 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •