1

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

pistacchio
  • 447
  • 7
  • 18

1 Answers1

2

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.

James Polley
  • 2,089
  • 15
  • 13
  • hi james, thanks for you answer. i changed the virtualhost to listen to *:80 but still on http://164.177.156.36/ and http://pistacchioso.com/ i see apache's default page, on http://www.pistacchioso.com/ and http://lessico.pistacchioso.com/ i see the courtesy page and i'm not able anymore to see the correct page. – pistacchio Feb 02 '12 at 07: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 02 '12 at 07: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 02 '12 at 07:14
  • http://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 02 '12 at 07: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 02 '12 at 07:17
  • Just have two vhosts - one listening on `*:8000` and `*:80`, with the same config in each. To simplify maintenance, you can move the common bits into a separate file and use the Include directive[1] to pull the config into both vhosts. [1]: http://httpd.apache.org/docs/2.0/mod/core.html#include – James Polley Feb 02 '12 at 08:50