LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 07-15-2011, 01:35 AM   #1
Macnux
LQ Newbie
 
Registered: Nov 2009
Posts: 3

Rep: Reputation: 0
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
 
Old 07-15-2011, 02:20 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,373

Rep: Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962
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.
 
Old 07-15-2011, 03:12 AM   #3
Lexus45
Member
 
Registered: Jan 2010
Location: Kurgan, Russia
Distribution: Slackware, Ubuntu
Posts: 339
Blog Entries: 3

Rep: Reputation: 47
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).

Last edited by Lexus45; 07-15-2011 at 03:59 AM.
 
1 members found this post helpful.
Old 07-15-2011, 03:14 AM   #4
sunnydrake
Member
 
Registered: Jul 2009
Location: Kiev,Ukraine
Distribution: Ubuntu,Slax,RedHat
Posts: 288
Blog Entries: 1

Rep: Reputation: 41
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)
 
Old 07-15-2011, 06:34 AM   #5
Macnux
LQ Newbie
 
Registered: Nov 2009
Posts: 3

Original Poster
Rep: Reputation: 0
OK. Thanks for both of those replies. However, where do I edit the ports sunnydrake?
 
Old 07-15-2011, 06:47 AM   #6
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,373

Rep: Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962
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>"
 
Old 07-15-2011, 09:56 AM   #7
Macnux
LQ Newbie
 
Registered: Nov 2009
Posts: 3

Original Poster
Rep: Reputation: 0
Thanks everyone. That worked a treat
 
Old 07-15-2011, 06:26 PM   #8
Larry James
Member
 
Registered: Jun 2000
Location: Buffalo, New York
Distribution: Fedora, Ubuntu
Posts: 343

Rep: Reputation: 38
Quote:
Originally Posted by Macnux View Post
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
apache virtual hosts ramjam Linux - Server 1 09-17-2009 06:15 AM
APACHE - Virtual Hosts luca2 Linux - Networking 3 12-27-2005 07:32 PM
Apache Virtual Hosts dienerk Linux - General 15 10-16-2004 12:46 AM
Apache Virtual Hosts quozt Linux - General 3 10-15-2003 09:51 AM
Apache Virtual Hosts (again) scatcat Linux - General 1 10-17-2002 09:51 AM


All times are GMT -5. The time now is 09:37 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration