Setting up multiple domains pointing at the same place

Status
Not open for further replies.

abarabas

Verified User
Joined
Apr 21, 2009
Messages
15
Well... I think I've googled all the possibly related web pages I could.

In my server, i have a domain named program.app, it's .app instead of .com because i don't need to access it. It's a product that, properly configured, could run from any domain showing different stuff to the visitor (it's a CMS). The problem I'm having is that while I could make the new domains like a pointer to program.app, it doesn't solve my problem because i need to control the bandwidth and all types of statistics.

So what i need is a way to make new domains point to program.app and still be able to set new mails, get statistics and limit it's bandwidth like any other domain. And then to set up new subdomains also pointing to program.app.

Is there a way to do this with the DA panel?

Thx for all
 
Give program.app it's own IP#.

When you create all the other domains, then manually edit the user-level httpd.conf file for the added domains, to point to the same DocumentRoot.

Can you do this without giving program.app it's own IP#?

Yes, but then you'll also have to modify the user-level httpd.conf file for the user hosting program.app, each time you add a new domain. You'll have to add a ServerAlias line for each domain you're pointing, in this format:
Code:
ServerAlias www.example.ecom example.com
You do NOTHING in DirectAdmin at all, but you must chattr the user level httpd.conf files so DirectAdmin won't try to rewrite them.

Jeff
 
Thanks for the quick reply!

Well, first of all I have only one ip...

And another thing is that I'm supposed to make a PHP newbie-proof program to setup the new domains, i can't be manually adding those lines. Is there a way to do that automatically?

Couldn't I edit it from :2222/CMD_CUSTOM_HTTPD? I'm not really sure where DA would put the lines i add, eg: "DocumentRoot /home/admin/domains/program.app/public_html". I should also be able to put it back to normal.

It works fine manually editing the DocumentRoot from the user-level httpd.conf
 
Last edited:
I don't think putting it into DirectAdmin will do it correctly; you can always try.

Sure you could write a program to run as root, with a php front end, and do it automatically, but only at the expense of having an insecure server.

If you use mod_php then it works when you edit DocumentRoot manually, but you have to be sure that that DirectAdmin won't change the file; that's why I mention chattr.

Security and usability are always tradeoffs.

For example, do you know why FreeBSD is considered the most secure OS by default? Because by default it doesn't connect to the 'net.

Jeff
 
Well... i've googled it a bit, and i came down to the following solution. I'm trying to use the sudo command within PHP's exec() but i can't figure out how to write root's password when i'm prompted to.

I've just figured out that that wont work because i need to write a file, that will only let me to read the file.

Any suggestion?
 
Last edited:
What you are trying to do can be very, very dangerous.
Anyway, since you asked... type "visudo", it will open an editor. At the bottom of that file insert this line:
Code:
user1 ALL=(root) NOPASSWD: /path/to/script
Then save the file.
This will let "user1" run "sudo /path/to/script", without asking any password (which, by the way, would be user1's password and not root's).
 
Well, i've almost done it throw the DA panel, but thx anyway.

What i could do was to edit the DocumentRoot in the domain's httpd.conf file from :2222/CMD_CUSTOM_HTTPD writing:
Code:
|?DOCROOT=/new/path/you/want|

But the thing is that doing this works fine just for the domain and not for the subdomains, because in the subdomains it changes to "/new/path/you/want/<nameofsubodmain>" and i need it to be the same path.

Any other suggestion?
 
I finally did it!

I ended up editing the template in /usr/local/directadmin/data/templates/ for the subdomain httpd configuration and i copied it to the custom folder so it wont be overwritten when i update DA.

Thx to jlasman for telling me i needed to change the DocumentRoot

you can close this thread now, thx.
 
Status
Not open for further replies.
Back
Top