-1

i'm trying to setup correctly a vhost under apache2. I'm running Suse 11.3.

What i'm trying is:

Add row to /etc/hosts

127.0.0.1 my.vhost.domain

Create file.conf under vhosts.d

<VirtualHost *>
DocumentRoot "/srv/www/vhosts/my.vhost.domain"
ServerName my.vhost.domain
</VirtualHost>

This is listen.conf

Listen 80
<IfDefine SSL>
    <IfDefine !NOSSL>
        <IfModule mod_ssl.c>

            Listen 443

        </IfModule>
    </IfDefine>
</IfDefine>

The server is in the intranet of the company where i work.

If i try to access from browser to the ip of the server all working fine. If i try to access to the host specified in vhost it response me with "Unknow Host".

What am I forgetting?

Thanks!!!

Jayyrus
  • 119
  • 1
  • 6
  • Did you restart the webserver? What URL? Have you tried pinging the address to see if it resolves? Normally there should not be more than line in the hosts file for each IP address and you should already have an entry for 127.0.0.1 - what happens when you fix this and restart the webserver? – symcbean Jan 29 '14 at 13:54
  • sure i did it!! i restarted webserver and i tried to ping address ( only the ip response to ping not vhost ) – Jayyrus Jan 29 '14 at 14:13
  • Where are you browsing from? The server or your computer? Looks like you are browsing from a computer and you are modifying the hosts file of the server. If it's your computer, then you need to modify the hosts file on your computer (or the DNS server if that is what you use which would be better than modifying hosts file on every computer...) – ETL Jan 30 '14 at 02:29
  • right! i need to set the hosts on my computer, something like server-ip my.vhost.domain, right? :) – Jayyrus Jan 30 '14 at 08:36

1 Answers1

1

This appears to be a DNS error. You need to have an A, AAAA or CNAME record configured in your DNS that will point my.vhost.domain to the IP address of the server hosting the domain.

user9517
  • 115,471
  • 20
  • 215
  • 297
  • No - its perfrctly possible to run apache with no available DNS service - it *is* a resolver issue. – symcbean Jan 29 '14 at 13:51
  • @symcbean: That's what I said didn't I - read my answer without a correctly configured DNS (or hosts file) the OP won't be able to resole the IP of the server and they'll get the error they see. – user9517 Jan 29 '14 at 13:52
  • No DNS is just one resource which can be used for resolving host names (also files, NIS, LDAP out of the box) – symcbean Jan 29 '14 at 13:55