LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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-14-2011, 02:48 PM   #1
splinux
Member
 
Registered: Jun 2011
Location: Sri Lanka
Distribution: centos,redhat,ubuntu
Posts: 90

Rep: Reputation: Disabled
we can host may web sites in single public ip ?


web 1 www.sp.com
web 2 www.spsun.com
web 3 www.sptos.com
single public ip 123.123.222.222

we can host these all web sites in single public ip ?

then if i type 123.123.222.222 in the browser which web site will be visible in the browser among from these 3 web ?

Last edited by splinux; 07-14-2011 at 02:49 PM.
 
Old 07-14-2011, 03:04 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
you can use a virtual host in Apache to respond to name based requests. If no hostname matches, such as when you use IPs, it's just the first one loaded from the config files, in the order they are configured.
 
1 members found this post helpful.
Old 07-14-2011, 10:44 PM   #3
splinux
Member
 
Registered: Jun 2011
Location: Sri Lanka
Distribution: centos,redhat,ubuntu
Posts: 90

Original Poster
Rep: Reputation: Disabled
I am writing all the configuration under /etc/httpd/conf.d/

in this is case how it will identify which one as 1st configuration ?
 
Old 07-15-2011, 02:17 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
As above it's the first one loaded in order.
 
Old 07-15-2011, 03:23 AM   #5
Diantre
Member
 
Registered: Jun 2011
Distribution: Slackware
Posts: 515

Rep: Reputation: 234Reputation: 234Reputation: 234
Quote:
Originally Posted by splinux View Post
I am writing all the configuration under /etc/httpd/conf.d/

in this is case how it will identify which one as 1st configuration ?
Apache identifies requests for virtual hosts based on their names. Have a look at the sample httpd-vhosts.conf:

Code:
NameVirtualHost *:80

<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot "/usr/docs/dummy-host.example.com"
    ServerName dummy-host.example.com
    ServerAlias www.dummy-host.example.com
    ErrorLog "/var/log/httpd/dummy-host.example.com-error_log"
    CustomLog "/var/log/httpd/dummy-host.example.com-access_log" common
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host2.example.com
    DocumentRoot "/usr/docs/dummy-host2.example.com"
    ServerName dummy-host2.example.com
    ErrorLog "/var/log/httpd/dummy-host2.example.com-error_log"
    CustomLog "/var/log/httpd/dummy-host2.example.com-access_log" common
</VirtualHost>
When the machine has one IP, apache uses the ServerName directive to identify which virtual host is being requested. You can read all about it in the Apache Virtual Host documentation.
 
  


Reply



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
LXer: Even Faster Web Sites: Performance Best Practices for Web Developers LXer Syndicated Linux News 0 07-07-2009 10:21 PM
Tools for developing C# web service and web sites in Linux woodbase Linux - Software 3 08-10-2006 01:28 PM
managing sites in apache[linux] and IIS with 1 public IP naveenrajn Linux - General 5 02-14-2006 03:43 AM
Free internet host for Linux Web sites? General General 3 11-28-2005 03:46 PM
Personal web server for testing web sites? Ariod Linux - Newbie 12 09-29-2005 04:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 08:38 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration