LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Subdomains on Apache2 with virtual hosts - how? (https://www.linuxquestions.org/questions/linux-networking-3/subdomains-on-apache2-with-virtual-hosts-how-354177/)

<Ol>Origy 08-17-2005 07:43 AM

Subdomains on Apache2 with virtual hosts - how?
 
Greetings linux users!

I'm having a bit difficulties understanding and configuring apache2 vhosts and network stuff as I am relatively new to these things. Let me explain my problem. I recently registered a domain (in this thread I will refer to it as "mydomain.com") and I have configured a web site on it using Apache 2 on Slackware linux 10.1 (my own PC, static IP address), port 80. If I type into a web browser www.mydomain.com or just mydomain.com or simply enter my IP, I will get the web page I configured as default.
Now the thing I do not understand is how to configure Apache2 using namevirtualhost (single PC with static IP, multiple websites on it) to use subdomains like "computers.mydomain.com" or "animals.mydomain.com" so that if a user types one of those two links (or just about anything else I put into httpd.conf vhosts tabs) into a web browser, he will get a different page hosted on my PC and not the default one.

I know I could just use www.mydomain.com/computers or www.mydomain.com/animals but I would like store websites in different folders like /var/www/html/animals and /var/www/html/computers and use subdomains to access them as it gives a bit more security.

I use the following comfiguration but the subdomain there doesn't work. It says that it couldn't find the webpage requested.

Part of my httpd.conf:

NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot /var/www/html/root
ServerName www.mydomain.com
ServerAlias mydomain.com
</VirtualHost>


<VirtualHost *:80>
DocumentRoot /var/www/html/downloads
ServerName downloads.mydomain.com
</VirtualHost>

And please don't point me to the official Apache 2 virtual host documentation aka. the place where I originally started. I don't quite understand it which is the reason why I ask here.

Thanks in advance!

<Ol>Origy 08-17-2005 12:05 PM

Okay, I did another search on this forum using a bit different keywords and it gave some promising results. Glad to see this has been answered. It seems that I have to configure DNS entries. at my ISP.

I have a new question now. Is it possible to configure a single universal dns subdomain entry that would count for all subdomains? So that (anything).mydomain.com would get forwarded to my IP?
My ISP doesn't allow configuring DNS directly.

<Ol>Origy 08-18-2005 05:53 AM

Ah nevermind. Talked to my ISP and they solved it.

Thank you for your help. :cool:


All times are GMT -5. The time now is 01:57 AM.