Virtual Host

S2S-Robert

Verified User
Joined
Jun 24, 2003
Messages
415
Location
The Netherlands
I have added "*.domain.com." as A record. This way every subdomain resolves to the ip address and then I get "This IP is being shared among many domains."

I've learned that adding a virtual host for *.domain.com would point everything to the right httpdocs directory, but my question is : how do I create such a vhost?

I've read the vhost topic for the reversed bot part, but that's not quite what I need, I just need it to point everything towards the right httpdocs dir.
 
Hello,

At the momment, you'd have to either change your virtual_host*.conf templates to have the * as an alias for the ServerName directive. Without it, it will default to the first virtual host in the list, the "shared domains" screen.

John
 
Actually, with the new cutom httpd.conf feature, you can simply add
Code:
ServerAlias [url]www.domain.com[/url] *.domain.com
to the custom httpd.conf field. Then you can just an A record
Code:
*  A   1.2.4.5

John
 
So am I correct that I have to edit the custom httpd.conf in "usr/local/directadmin/data/users/<user>"?

And after that I have to restart the httpd right?
 
Sorry, I wasn't clear on that. Our custom httpd.conf feature can be accessed from:

Admin Panel, Admin Settings, Customize Httpd Configurations, domain.com.

Just add any customizations there, and you should be able to see the new results in the text field below.

John
 
At this moment the file looks like this (part of it):

Code:
DocumentRoot /home/sevendwa/domains/sevendwarfs.org/public_html
ScriptAlias /cgi-bin/ /home/sevendwa/domains/sevendwarfs.org/public_html/cgi-bin/

The modification would be:

Code:
DocumentRoot /home/sevendwa/domains/sevendwarfs.org/public_html
ScriptAlias /cgi-bin/ /home/sevendwa/domains/sevendwarfs.org/public_html/cgi-bin/
ScriptAlias [url]www.sevendwarfs.org[/url] *.sevendwarfs.org

Is this correct? Shouldn't the "*" & "WWW" be reversed? Because analogue to the /cgi-bin which points to the actual directory, so * would point to "WWW" or am I mistaken here?
 
Yeah I was thinking along the same lines, but as John's advice is to do it using scriptalias I thought let's follow his advice ;)

John can you enlighten us on this part?

Oh btw the reason I'm doing this using the forum is that other customers might benefit from it and add another 'feature' to their webhosting products :D
 
Oh :) sorry about that, yes ScriptAlias should in fact be ServerAlias. That will probalby work better ;) (I'll edit the post)

And yes, you could probaly try just the *.domain.com without the www part.

John
 
Code:
	ServerName [url]www.sevendwarfs.org[/url]
	ServerAlias [url]www.sevendwarfs.org[/url] sevendwarfs.org *.sevendwarfs.org
	ServerAdmin [email][email protected][/email]
I now have this as settings. I saved it, but nothing changed. Should I restart the httpd now?

[EDIT]

I don't know exactly what happened, but once I used save the document was appended to the existing httpd.conf and apache stopped. I had to download the file, edit it locally and reupload it. It still does not work however. Could you show the full httpd.conf that I need in order for it to work?

How do you use that customize feature anyway? I tried searching for help on admin.site-helper.com but it doesn't make it any clearer.
 
Last edited:
Ok it's finally working.

I've replaced serveralias with only *.sevendwarfs.org and added an A record for "*.sevendwarfs.org." it's essential that you create it with the domain name included, because otherwise it doesn't seem to work.

I was still unable to edit the file using the admin control panel, because it inserted text into the wrong section and it made apache refuse to start up again. My advice would be to make the complete field editable so you can have complete control over the final text file.

Perhaps the risk factor was taken into account whilst doing this, but then again if you start using this feature you should be well aware of the consequences... You could create an original backup copy that you could restore if problems were to arise. Bypass the risk factor this way and I would be completely happy :D
 
Re: cutom httpd.conf feature

The custom httpd.conf feature is so new that we havn't had a chance to include it in the site-helper documentation (doesn't exist at all).

What the feature does is inserts the small snippet of code you enter into the field into the |CUSTOM| token in the virtual host template. It is not intended to be used to for manual entry of the *whole* virtual host. This is why you only need the one ServerAlias line to be added; the rest will be inserted normally around it.

John
 
I manually uploaded the "httpd.conf" file, but it seems that after a reboot it's replaced by the old one again. I still can't figure out how the custom httpd.conf feature quite works, so I'll just hope you guys get the time to update the site-helper website ;)
 
Hello,

Until then, you can access the feature from:

Admin Panel -> Admin Settings -> Customize http.conf -> domain.com

From there you can add the required settings.

John
 
Back
Top