Trouble with multiple domains on one machine :(
I've been following this tutorial…
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
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:
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:
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.
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!
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
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
<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.