Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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
<VirtualHost *:80>
DocumentRoot "/opt/lampp/htdocs/fwarlords"
ServerName fwarlords.biyg.org
<Directory "/opt/lampp/htdocs/fwarlords">
allow from all
Options +Indexes
</Directory>
</VirtualHost>
But it's wrong. If you go to zeno.biyg.org which should point to the server I run (the index site) it still points to the fwarlords folder for some reason. How can I fix this?
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".
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
<VirtualHost *>
DocumentRoot "/opt/lampp/htdocs/"
ServerName biyg.org
ServerAlias *.biyg.org
<Directory "/opt/lampp/htdocs/fwarlords">
allow from all
Options +Indexes
</Directory>
</VirtualHost>
<VirtualHost *>
DocumentRoot "/opt/lampp/htdocs/fwarlords"
ServerName fwarlords.biyg.org
<Directory "/opt/lampp/htdocs/fwarlords">
allow from all
Options +Indexes
</Directory>
</VirtualHost>
Make the necessary changes for actual file paths but it should look something like that. And you don't necessarily need to specify the port in the VirtualHost tag if the default is already 80. And you might not need the <Directory> tags for your main domain of biyg.org either, but like I said, mine is just an example of what should work.
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.
[Wed Dec 13 19:24:27 2006] [warn] NameVirtualHost *:80 has no VirtualHosts
But now if you go to fwarlords.biyg.org or zeno.biyg.org, both point to the index. Fwarlords should bring you to the fwarlords folder, but no longer does.
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.
Last edited by Zeno McDohl; 12-13-2006 at 06:51 PM.
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.
Oh wait. I tested fwarlords.biyg.org and just biyg.org, which take you to different pages. If you need zeno.biyg.org to go to a different page, you have to also create a VirtualHost for it as well.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.