I guess Ill go first

I'm trying to set up Apache to serve3 or 4 domains I already own. I would like to use virtual domains to host them, (if thats possible, since I can point the current registrars nameservers anywhere I want. (virtual.mydomain.com can be used with the forwarding option on buydomains). I just cant figure out how to get this working without a local nameserver and with the already virtual domain via linode as my primary host.(li-xx.members.linode.com) Do you have an example of a working apache conf file I can look at? If I have to add IP's I will but if I understand all this correctly I don't think I have to. Ill do whatever works the best but multiple top level domains is a must and sub (user) domains under each one would be cool too. You know , like a nested web server structure? confusing? no shit. HELP please. I will also want to use PHP and Mysql with all of them, perhpas even user level web sites (web pub for each user on the system)

3 Replies

I'll take a crack at it.

For this example, I'll use 64.1.2.3 as the IP, www.example.com and www.foobar.com as the domains.

Make sure "www.example.com" resolves to 64.1.2.3

Make sure "www.foobar.com" resolves to 64.1.2.3 too

Test it from your home computer using "nslookup www.example.com" and "nslookup www.foobar.com". The domains must be resolving to your IP to do named-based virtual hosts.

Edit your apache.conf/httpd.conf file (usually in /etc/apache or /etc/httpd/conf/). Here's some examples:

...
Port 80
ServerName li-3.members.linode.com
DocumentRoot /var/www/html

NameVirtualHost *

 <virtualhost *="">DocumentRoot /www/example.com
ServerName www.example.com example.com
...</virtualhost> 

 <virtualhost *="">DocumentRoot /www/foobar.com
ServerName www.foobar.com foobar.com
...</virtualhost> 

This would serve three sites. The linode's default address would be served out of /var/www/html. Requests to "www.example.com" would be served out of /www/example.com, and foobar.com out of /www/foobar.com.

Check out http://httpd.apache.org/docs/vhosts/examples.html

Apache is very flexible. It will do what you tell it :-)

-Chris

ok so it looks pretty simple - the linode domain HAS to be the primary apparently. Will the document paths listed work with multiple users and mySQL? Do i need to create a system user for each virtual domain? I just keep wondering where UML starts changing things. And thanks for your help. I'll let u know how it goes when i try it.

@ne0:

ok so it looks pretty simple - the linode domain HAS to be the primary apparently. Will the document paths listed work with multiple users and mySQL? Do i need to create a system user for each virtual domain? I just keep wondering where UML starts changing things. And thanks for your help. I'll let u know how it goes when i try it.

The Linode's IP/domain does NOT have to be the first, or in there at all.

mySQL uses it's own path to store it's databases.

Creating a system user for each domain is useful if you plan on providing them an FTP account, so they can update their sites.

Also – UML doesn't change any of this. It is just like a 'regular' machine.

Good luck!

-Chris

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct