LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (http://www.linuxquestions.org/questions/linux-server-73/)
-   -   Apache Virtual Hosts - Ubuntu Desktop (http://www.linuxquestions.org/questions/linux-server-73/apache-virtual-hosts-ubuntu-desktop-891826/)

Macnux 07-15-2011 01: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,
Jordan

acid_kewpie 07-15-2011 02: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 03: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/www.site1.com" and "/var/www/htdocs/www.site2.com".
- 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 03:14 AM

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

Macnux 07-15-2011 06:34 AM

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

acid_kewpie 07-15-2011 06: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 09:56 AM

Thanks everyone. That worked a treat :)

Larry James 07-15-2011 06:26 PM

Quote:

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
ljames@apollo3.com
www.apollo3.com/~ljames


All times are GMT -5. The time now is 04:05 AM.