Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have an Apache instance serving a site on port 8000 of my server (whose ip is 164.177.156.36)

Listen 8000

<VirtualHost *:8000>
    ServerName lessico.pistacchioso.com
    DocumentRoot /home/pistacchio/sites/lessico/
    [..]

This works if I visit http://164.177.156.36:8000/

On my registry provider (that is not the same a my server provider) i have the following records set:

enter image description here

pistacchioso.com is the domain i registered and i want lessico.pistacchioso.com to point to http://164.177.156.36:8000/

Those seeweb.it servers are the domain register's ones, i'm ok leaving the mail there (MX) and I can't remove those two NS records (while I can add others).

At the moment, if I visit http://lessico.pistacchioso.com/ I still see the register's courtesy page. The DNS already updated, because pistacchio.com shows apache's standard default page. Any help? Thanks

share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

I can confirm that, for me:

  • DNS shows I would expect:

    james@bodacious-wired:~$host lessico.pistacchioso.com
    lessico.pistacchioso.com is an alias for pistacchioso.com.
    pistacchioso.com has address 164.177.156.36
    
  • Browsing to http://164.177.156.36:8000/ appears to show the right page

  • Browsing to http://lessico.pistacchioso.com:8000/ shows the same page
  • Browsing http://lessico.pistacchioso.com/ shows the default web page for this server. because no content has been added, yet.

I think that what you're missing here is that you're telling the browser to use the http protocol - right there in the first 4 characters of the url, http://

Browsers understand that, unless another port number is specified, http means port 80, so http://lessico.pistacchioso.com/ is interpreted as if it were http://lessico.pistacchioso.com:80/. However, in the snippet you've provided above, you've used VirtualHost *:8000 to tell Apache to only listen on port 8000 for this request.

This explains why http://lessico.pistacchioso.com:8000/ works: you're explicitly telling the browser to use port 8000; and you've told Apache to listen on port 8000 and what to do with requests received there.

Change that line to VirtualHost *:80 and you'll be answering traffic on port 80 instead. The ServerName directive you have on the next line ensures that only traffic for the host lessico.pisacchioso.com will be handled by this vhost - all other hostnames will still fall back to the default vhost with the default content you're already so familiar with :)

Edited to add:

There's one other wrinkle. You said:

if I visit http://lessico.pistacchioso.com/ I still see the register's courtesy page. The DNS already updated, because pistacchio.com shows apache's standard default page

That's different from what I see - I get Apache's standard page on http://lessico.pistacchioso.com/. I'm guessing that either your DNS host updated something between when you posted and when I responded; or possibly you still have an old record cache. I'd suggest checking this with host as I've done above to make sure you're seeing the correct records.

share|improve this answer
    
hi james, thanks for you answer. i changed the virtualhost to listen to *:80 but still on 164.177.156.36 and pistacchioso.com i see apache's default page, on pistacchioso.com and lessico.pistacchioso.com i see the courtesy page and i'm not able anymore to see the correct page. –  pistacchio Feb 2 '12 at 7:10
    
oh, i've also tried cleaning up the system dns cache and browser's. on the other hand, host pistacchioso.com gives the correct ip :\ –  pistacchio Feb 2 '12 at 7:11
    
If you check Apache's access logs, you should see logs being written when you connect to 164.177.156.36. Do you also see logs being written when you browse to pistacchioso.com? –  James Polley Feb 2 '12 at 7:14
    
lessico.pistacchioso.com now gives me what looks like the correct page - it's a login form that looks like it's intended to be viewed on a mobile browser. I'm guessing that your ISP must have some kind of transparent proxy that's still serving up the old page - it definitely looks like your server and dns are now configured correctly –  James Polley Feb 2 '12 at 7:15
    
you are right, thank you. viewing it through a proxy showed me the correct page! do i just have to wait for the isp to refresh its caching? also, how can i configure apache to serve both lessico.pistacchoso.com AND 164.177.156.36:8000? thank you –  pistacchio Feb 2 '12 at 7:17
show 1 more comment

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.