-   Linux - Server (
-   -   Apache Virtual Hosts - Ubuntu Desktop (

Macnux 07-15-2011 02:35 AM

Apache Virtual Hosts - Ubuntu Desktop
Hi all.
I have just setup two Apache virtual hosts and I was wondering how I could link them to different domains so that they could be accessed from another machine. Any help would be greatly appreciated.
Many thanks,

acid_kewpie 07-15-2011 03:20 AM

What do you mean by linking? You would normally use DNS records to reach the same IP with different names. Note that Apache doesn't know about the DNS at all. It just is told to serve this set of.pages.when that domain is requested.

Lexus45 07-15-2011 04:12 AM

Apache virtual hosts can be IP-based and name-based.
I think you have name-based, it means that the webserver has only 1 IP-address, but hosts websites of 2 different domains.

In this case you must follow the instructions of setting name-based virtual hosts.
In a nutshell:
- each website will have a separate directory, like "/var/www/htdocs/" and "/var/www/htdocs/".
- Apache config file will have "rules" about these directories/sites
- it's also recommended to create a section in the config file which will "push" the client to some certain directory/HTML page/default site, if he entered the IP-address of your server in the browser, not the FQDN of a concrete site. (Though, not sure, maybe the 1st virtual host will serve as defalt destination).

sunnydrake 07-15-2011 04:14 AM

example virtualhost 1 port 3333 virtualhost 2 port 4444 register at domain XXX and XXX2 redirect (paid feature?) => your_ip:3333>your_ip:4444 ... i just use free (my port 80 blocked by ISP)

Macnux 07-15-2011 07:34 AM

OK. Thanks for both of those replies. However, where do I edit the ports sunnydrake?

acid_kewpie 07-15-2011 07:47 AM

in the httpd.conf or additional config file. firstly you need to have a "Listen 12345" directive in the main body of the config, and then in the virtual host you can specify "<Virtualhost *:12345>"

Macnux 07-15-2011 10:56 AM

Thanks everyone. That worked a treat :)

Larry James 07-15-2011 07:26 PM


Originally Posted by Macnux (Post 4415719)
Thanks everyone. That worked a treat :)

Macnux. You might consider contributing back to the community by marking this topic as Solved. This way others with similar problems will be able to benefit by looking at the Solved threads for solutions to their problems.

Also, in my case, being very fluent with the Apache web server, I was reading and unsolved topic so that I could offer a solution. I could have spent the time with another user's thread who is still looking for an answer.

Have a nice day!

-- L. James

L. D. James

All times are GMT -5. The time now is 01:14 AM.