Apache: virtual host issue
I have a server I pay for, and one I run. My biyg.org points to the server I pay for. I want fwarlords.biyg.org (and only that) to point to a certain folder (fwarlords) on the server I run. Here is what I have in the httpd.conf:
Code:
NameVirtualHost *:80 |
My understanding of apache:
It looks in the virtualhost section for the servername (fwarlords......). Next it takes the associated document root and looks in there for the pages. And the associated document root refers to the system where apache is running (so the server that you pay for). I might, however, be totally wrong. The only way I see is that you mount the directory of your own server on the server that you pay for. Wonder if your hosting provider allows this. As an alternative, you can create an index page on the server that you pay for and let that redirect the visitor to the site on your own server; this is however not as neat. |
I'm pretty sure it can be done, there are examples I seem to have seen but can't remember offhand at this time. Oh and I forgot to mention, the domain (biyg.org) is set to the nameserver of my paid server. That's what I mean by "pointing to the server I pay for".
|
Could it be the zone records in the name server that hosts the domain biyg.org?
If the name server doesn't know where to direct the subdomain to there could be problems... |
You're telling me I have to talk to my paid hosting server every time I want to make a new subdomain (that I own) that points to my own server?
|
Remember, from your main server configuration in httpd.conf, when creating a VirtualHost, you'll also need a configuration for your main domain, when creating a subdomain.
Make you're original look like this: Code:
NameVirtualHost *:80 Plus after making changes, you need to restart apache for the configs to be reread. You can run a configtest to test the configuration before restarting to prevent any failures if the configs won't work and then your site is unaccessible. |
That looks right (the paths), so here's what I put in:
Code:
NameVirtualHost *:80 Quote:
|
What version of Apache are you running? Try adding the *:80 in the <VirtualHost> tags for each VirtualHost.
|
I just tested both of these domains and they both seem to resolve to different pages. From this end I would assume they are working.
|
Really? zeno.biyg.org takes you to a different page than fwarlords.biyg.org? It doesn't for me. I just talked to a friend, he also says both pages take him to the same page (which is wrong).
Apache version 1.3.33, adding that :80 part fixes the warning but not the sites. |
Quote:
|
Oh, okay. Because biyg.org has nothing to do with what we're doing here.
But uh... zeno.biyg.org goes to the right page, fwarlords.biyg.org does not. Even though I already have a VirtualHost (like you told me to do) for that. Right now fwarlords.biyg.org points to /opt/lampp/htdocs/ instead of /opt/lampp/htdocs/fwarlords |
I might not be clear, since there seems to be some misunderstanding.
ServerA: A webserver host I am paying for. ServerB: My own server (located in my room). Domain: I own the biyg.org domain. The domain uses ServerA's nameserver. Both fwarlords.biyg.org and zeno.biyg.org need to point to ServerB. Which they do. fwarlords.biyg.org needs to point to /opt/lampp/htdocs/fwarlords on ServerB, while zeno.biyg.org needs to point to /opt/lampp/htdocs/ on ServerB. wwww.biyg.org has nothing to do with this. With this: Code:
NameVirtualHost *:80 |
mrJimmbo has identified your problem. Requests for biyg.org go to the server at your paid hosting service. The DNS server there needs to know where to direct subdomain requests. This is ususally done by adding a "A" record.
|
I already have A records for both subdomains, they both point to ServerB's IP. Is that correct?
|
Since it brings the subdomains to ServerB, I assume it's fine. The problem is probably in the conf file which is why I asked in the first place.
|
Code:
NameVirtualHost *:80 Note: this is trickykid's example with one or two lines changed. ETA: The first virtual server defined is the default. |
Thanks, I had to change a bit but that worked. Thanks again.
|
All times are GMT -5. The time now is 03:10 AM. |