Trouble with multiple domains on one machine :(

Can anyone have a gander at this? I'm trying to setup some websites and so far I have one domain added as a virtual host. Trouble is the domain is not pointing to the specific directory I created for it.

I've been following this tutorial…

http://library.linode.com/lamp-guides/u … -maverick/">http://library.linode.com/lamp-guides/ubuntu-10.10-maverick/

And I have set the virtual host as described and checked that they're are no typos and restarted my apache server, but it's still pointing to the default "It works!" page.

My domain is registered with an external registrar and I have the nameservers pointing at n1.linode.com all the way to n5.linode.com. I have also created a DNS zone for the domain in the Linode Domain Manager with the default settings populated by the DNS Manager.

Any thoughts on what I could be doing wrong? Many thanks.

7 Replies

If the domain is resolving to your Linode then your DNS is working properly, so the issue is specific to your virtual host configuration. (assuming the "it works" page you are seeing is in fact your own.)

I suppose the first thing I would check (since you indicated you already restarted apache) is that virtual hosts are in fact enabled. In /etc/apache2/apache2.conf, at the bottom I have "include sites-enabled".

Interestingly enough, based on a post I saw here recently, all my virtual host directives start with:

…instead of including the full IP address as shown in the tutorial. The Apache2 docs say to use *:80 for name-based virtual hosts, but docs and tutorial both indicate that adding the IP is a good practice if you plan to add IP addresses later and want the vhost to only listen on that IP; I don't know if this could relate to your problem or not.

Ensure your virtual host is in /etc/apache2/sites-enabled (and not just sites-available)…sometimes people overlook that step (a2ensite…). And that your servername and serveralias directives reflect the correct names. If you make any changes reload your apache config or restart the server.

The docs page may help:

http://httpd.apache.org/docs/current/vh … based.html">http://httpd.apache.org/docs/current/vhosts/name-based.html

Also, to rule out a browser cache, clear your cache or try a different browser that hasn't been used to access the site before. Usually developers turn caching off but you'd hate for it to be something so simple.

Beyond that, a headcold prevents me from sitting at my desk any more today, so I hope you find success.

> I suppose the first thing I would check (since you indicated you already restarted apache) is that virtual hosts are in fact enabled. In /etc/apache2/apache2.conf, at the bottom I have "include sites-enabled".

You're a life saver. I looked at the file and it turns out this was missing, but when I compared it to a another install on my own linux machine I noticed it was there. I added it to the bottom and restarted apache and now it works.

Hope you're cold clears up soon mate.

Many thanks again.

If it helps any, the Linode library articles suggest that

name *:80 directive format.

Also, they suggest the

Alias blah.com or whatever as an additional directive.

Hope that also can be of some use!

Hi,

For the life of me and 3 coffees later I cant get this virtual host stuff working. I have everything done as per the tutorial and this thread. If I add a 2nd domain say example123.com what do I have to change in DNS manager in Linode. The virtual host is pointing to:

 <virtualhost *:80="">ServerName example123.com
    DocumentRoot /srv/www/example123.com/public_html/
    ErrorLog /srv/www/example123.com/logs/error.log
    CustomLog /srv/www/example123.com/logs/access.log combined</virtualhost> 

sites have been enabled, made available and apache reloaded. apache2.conf has the includes..but I get an unable to connect error in the browser (Firefox can't establish a connection to the server)when I go to http://example123.com/

After setting up Linode day 1 a file is created in srv/www called eg li123-456.members.linode.com…Initially after adding my new domains via DNS Manager and b4 the virtual host attempt both my domains pointed to files within this srv/www/li123-456.members.linode.com/public_html folder by default. My 2 domains also show eg example123.com as a subdomain in NS Records. Everything uses the same IP. By default it appears li123-456.members.linode.com shows up in the sites-available and sites-enabled folder. I added my 2 new domains in here too as per tutorial.

Any ideas? It must be something simple like a change in the dns manager

Thanks Guys

@Ralph:

Hi,

For the life of me and 3 coffees later I cant get this virtual host stuff working. I have everything done as per the tutorial and this thread. If I add a 2nd domain say example123.com what do I have to change in DNS manager in Linode. The virtual host is pointing to:

 <virtualhost *:80="">ServerName example123.com
    DocumentRoot /srv/www/example123.com/public_html/
    ErrorLog /srv/www/example123.com/logs/error.log
    CustomLog /srv/www/example123.com/logs/access.log combined</virtualhost> 

sites have been enabled, made available and apache reloaded. apache2.conf has the includes..but I get an unable to connect error in the browser (Firefox can't establish a connection to the server)when I go to http://example123.com/

After setting up Linode day 1 a file is created in srv/www called eg li123-456.members.linode.com…Initially after adding my new domains via DNS Manager and b4 the virtual host attempt both my domains pointed to files within this srv/www/li123-456.members.linode.com/public_html folder by default. My 2 domains also show eg example123.com as a subdomain in NS Records. Everything uses the same IP. By default it appears li123-456.members.linode.com shows up in the sites-available and sites-enabled folder. I added my 2 new domains in here too as per tutorial.

Any ideas? It must be something simple like a change in the dns manager

Thanks Guys

Add this to your virtual host file

ServerAlias somedomain.com

Here's what I'm using:

 <virtualhost *:80="">ServerName www.example.com
  ServerAlias example.com *.example.com
  DocumentRoot /srv/www/example.com/public_html</virtualhost> 

Make sure the directory exists and restart Apache after each modification.

Thanks got it working when I did it over

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct