Jump to content

subdomains with apache


lobotommy

Recommended Posts

Hi,

 

I\'m running an apache webserver on SUSE.

My domainname is linked to the nameservers of no-ip.com.

I have wildcards enabled, so *.mydomain.tld goes via a webdirect to my webserver 192.168.0.2 (via portforwarding on my firewall)

 

Now I want to server name based virtual hosts on the apache but I CANNOT find the right info in the apache manuals

 

ex: mydomain.tld has docroot /www/htdocs/main

sub1.mydomain.tld has docroot /www/htdocs/sub1

sub2.mydomain.tld has docroot /www/htdocs/sub2

 

I tried the following virtualhosts setup:

 

<VirtualHost *>

DocRoot /www/htdocs/main

ServerName mydomain.tld

</VirtualHost>

<VirtualHost *>

DocRoot /www/htdocs/sub1

ServerName sub1.mydomain.tld

</VirtualHost>

<VirtualHost *>

DocRoot /www/htdocs/sub2

ServerName sub2.mydomain.tld

</VirtualHost>

 

Whatever url I type in, I always get connected to the domain mydomain.tld (so the index file in /www/htdocs/main)

 

 

I would greatly appreciate if someone could help me out here!

 

Many thanks,

Tommy

Link to comment
Share on other sites

Just a thought, but do you have the right syntax in there?

According to the Apache docs, it should be:

   NameVirtualHost *

 

   <VirtualHost *>

   ServerName www.domain.tld

   DocumentRoot /www/domain

   </VirtualHost>

whereas you have:

<VirtualHost *>  

DocRoot /www/htdocs/sub1  

ServerName sub1.mydomain.tld  

</VirtualHost>

I don\'t know if you have \"DocumentRoot\" in full in your httpd.conf?

 

D

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.