[VirtualHost] How to add a subdomain value?

Aziz

Verified User
Joined
Oct 4, 2004
Messages
125
Hello guys,

I have had this problem a long time ago, but never bothered with it because I didnt need it..

Now that I needed, I want to be able to access subdomains:

http://test.marsaldesign.com or http://www.test.marsaldesign.com

Not, currently:

http://www.marsaldesign.com/test

I read some other place:


That I have to add:

<VirtualHost>

ServerAlias marsaldesign.com*.marsaldesign.com

</VirtualHost>

to my virtual host. Also I have to:

Add a domain record of *.marsaldesign.com as an A record to my Ip

Now the record part I got, but the virtual host im having a hard time..

Code:
*.marsaldesign.com.	A	207.234.147.185
test.marsaldesign.com	A	207.234.147.185
[url]www.test	A	207.234.147.185[/url]

Where is the file (virtual host) that I have to edit to make it work, and What do I need to change to make it work..

And do I have to do that for all domains?

Thank you in advance..

Peace,
 
Last edited:
I won't tell you why I believe wildcard DNS is a bad idea, because no one seems to agree with me :) .

But I've moved the thread to Apache (WWW) because it's the right place if you're asking about apache issues rather than DNS issues.

If you're the systems admin you can customize each user's httpd.conf file through the admin control panel.

And you will have to do it for all the domains.

If you want it to work for all future domains, you can make changes to the templates:

/usr/local/directadmin/data/templates

First move them to:

/usr/local/directadmin/data/templates/custom

Jeff
 
jlasman said:
I won't tell you why I believe wildcard DNS is a bad idea, because no one seems to agree with me :) .

But I've moved the thread to Apache (WWW) because it's the right place if you're asking about apache issues rather than DNS issues.

If you're the systems admin you can customize each user's httpd.conf file through the admin control panel.

And you will have to do it for all the domains.

If you want it to work for all future domains, you can make changes to the templates:

/usr/local/directadmin/data/templates

First move them to:

/usr/local/directadmin/data/templates/custom

Jeff

Thanks for reply..

Can you verify that:

ServerAlias marsaldesign.com *.marsaldesign.com

(because logically I do not see how it workds, redirecting all subdomains to the main one?)

Is what I have to add in for the domain, and which of the above three records I need.

I appreciate your reply,

Peace,
 
I don't know; I've never tried it with a wildcard.

Test it yourself :) .

Jeff
 
jlasman said:
I don't know; I've never tried it with a wildcard.

Test it yourself :) .

Jeff

Lets say I dont want to do it with wildcard, lets say test subdomain:

ServerAlias marsaldesign.com test.marsaldesign.com

I dont see a way to remove anything I add with the control panel, i dont want to screw things up..

Thanks,
 
Ok, I did the following for Virtual host for the subdomain (via command prompt), since the admin does not allow you to choose which virtual host to edit:

Code:
<VirtualHost 207.234.147.185:80>


	ServerName [url]www.test.marsaldesign.com[/url]
	ServerAlias [url]www.test.marsaldesign.com[/url] test.marsaldesign.com
	ServerAdmin [email][email protected][/email]
	DocumentRoot /home/admin/domains/marsaldesign.com/public_html/test
	ScriptAlias /cgi-bin/ /home/admin/domains/marsaldesign.com/public_html/test/cgi-bin/
	
	UseCanonicalName OFF

	User admin
	Group admin
	CustomLog /var/log/httpd/domains/marsaldesign.com.test.bytes bytes
	CustomLog /var/log/httpd/domains/marsaldesign.com.test.log combined
	ErrorLog /var/log/httpd/domains/marsaldesign.com.test.error.log
	<Directory /home/admin/domains/marsaldesign.com/public_html/test>
		Options +Includes -Indexes
		php_admin_flag engine ON
		php_admin_flag safe_mode OFF
		php_admin_value sendmail_path '/usr/sbin/sendmail -t -i -f [email][email protected][/email]'
	</Directory>


	
	#php_admin_value open_basedir /home/admin/:/tmp/:/var/www/:/usr/local/lib/php/:/etc/virtual/

</VirtualHost>


<VirtualHost 207.234.147.185:443>

	SSLEngine on
	SSLCertificateFile /etc/httpd/conf/ssl.crt/server.crt
	SSLCertificateKeyFile /etc/httpd/conf/ssl.key/server.key
		

	ServerName [url]www.test.marsaldesign.com[/url]
	ServerAlias [url]www.test.marsaldesign.com[/url] test.marsaldesign.com
	ServerAdmin [email][email protected][/email]
	DocumentRoot /home/admin/domains/marsaldesign.com/private_html/test
	ScriptAlias /cgi-bin/ /home/admin/domains/marsaldesign.com/public_html/test/cgi-bin/

	UseCanonicalName OFF

	User admin
	Group admin
	CustomLog /var/log/httpd/domains/marsaldesign.com.test.bytes bytes
	CustomLog /var/log/httpd/domains/marsaldesign.com.test.log combined
	ErrorLog /var/log/httpd/domains/marsaldesign.com.test.error.log

	<Directory /home/admin/domains/marsaldesign.com/private_html/test>
		Options +Includes -Indexes
		php_admin_flag engine ON
		php_admin_flag safe_mode OFF
		php_admin_value sendmail_path '/usr/sbin/sendmail -t -i -f [email][email protected][/email]'
	</Directory>



	#php_admin_value open_basedir /home/admin/:/tmp/:/var/www/:/usr/local/lib/php/:/etc/virtual/

</VirtualHost>


Still I cant access the domain name, as I see in this virtual host. Its saying that even: www.test.marsaldesign.com should work, but its not?

Thanks for any help, and thanks jlasman for your last reply :)

Peace,
 
I also tried this:

ServerAlias www.test.marsaldesign.com /home/admin/domains/marsaldesign.com/public_html/test
ServerAlias test.marsaldesign.com /home/admin/domains/marsaldesign.com/public_html/test

but that also didnt work?

please, any help?

Peace,
 
Back
Top