Virtual domains on Apache with only one ip?

Virtual domains on Apache with only one ip?

Post by Nico Zigoura » Wed, 12 Jul 2000 04:00:00



Hello:

Is there a way to run two domains ( a virtual domain ) off of Apache when
you only have one ip?  My isp only can give me one.  I am running Apache
(? version) on a Cobalt Linux server (some version of Redhat I
think).  Thanks.

 
 
 

Virtual domains on Apache with only one ip?

Post by The Wease » Wed, 12 Jul 2000 04:00:00


Yes, read the Apache FAQs. Here is an example; you would change this and put
it into your httpd.conf file, at the end:

NameVirtualHost [your NIC's IP address]
<Virtual Host [your nic's IP address]>
    ServerName www.yourdomain.com
    DocumentRoot /www/htdocs.yourdomain.com
</VirtualHost>
<Virtual Host [your NIC's IP address]>
    ServerName www.yourOTHERdomain.com
    DocumentRoot /www/htdocs.yourOTHERdomain.com
</VirtualHost>

--
I am a weasel. Weasels love mice.
Weasels are cute, and mice are cute.
Therefore, weasels are mice.
http://weasel.faricy.net


Quote:> Hello:

> Is there a way to run two domains ( a virtual domain ) off of Apache when
> you only have one ip?  My isp only can give me one.  I am running Apache
> (? version) on a Cobalt Linux server (some version of Redhat I
> think).  Thanks.


 
 
 

Virtual domains on Apache with only one ip?

Post by Rafael Garcia-Suar » Wed, 12 Jul 2000 04:00:00


Nico Zigouras wrote in comp.infosystems.www.servers.unix:

Quote:>Hello:

>Is there a way to run two domains ( a virtual domain ) off of Apache when
>you only have one ip?  My isp only can give me one.  I am running Apache
>(? version) on a Cobalt Linux server (some version of Redhat I
>think).  Thanks.

Yes, with the NameVirtualHost directive. Look it up in the docs.

--
Rafael Garcia-Suarez

 
 
 

Virtual domains on Apache with only one ip?

Post by Nico Zigoura » Wed, 12 Jul 2000 04:00:00


Yes I tried the NameVirtualHost directive - it did not work - both domains
still got the origianl domain home page.  Thanks for the pointers though.

> Date: Tue, 11 Jul 2000 06:20:06 GMT

> Newsgroups: comp.infosystems.www.servers.unix
> Subject: Re: Virtual domains on Apache with only one ip?

> Nico Zigouras wrote in comp.infosystems.www.servers.unix:
> >Hello:

> >Is there a way to run two domains ( a virtual domain ) off of Apache when
> >you only have one ip?  My isp only can give me one.  I am running Apache
> >(? version) on a Cobalt Linux server (some version of Redhat I
> >think).  Thanks.

> Yes, with the NameVirtualHost directive. Look it up in the docs.

> --
> Rafael Garcia-Suarez

 
 
 

Virtual domains on Apache with only one ip?

Post by Nico Zigoura » Wed, 12 Jul 2000 04:00:00


Never  mind, the kind gentleman named the Weasel helped me - I was not
using my internal ip but the one my isp gave me.  That was the problem.  
Thanks folks.

> Date: Tue, 11 Jul 2000 03:02:31 -0400


> Newsgroups: comp.infosystems.www.servers.unix
> Subject: Re: Virtual domains on Apache with only one ip?

> Yes I tried the NameVirtualHost directive - it did not work - both domains
> still got the origianl domain home page.  Thanks for the pointers though.


> > Date: Tue, 11 Jul 2000 06:20:06 GMT

> > Newsgroups: comp.infosystems.www.servers.unix
> > Subject: Re: Virtual domains on Apache with only one ip?

> > Nico Zigouras wrote in comp.infosystems.www.servers.unix:
> > >Hello:

> > >Is there a way to run two domains ( a virtual domain ) off of Apache when
> > >you only have one ip?  My isp only can give me one.  I am running Apache
> > >(? version) on a Cobalt Linux server (some version of Redhat I
> > >think).  Thanks.

> > Yes, with the NameVirtualHost directive. Look it up in the docs.

> > --
> > Rafael Garcia-Suarez

 
 
 

Virtual domains on Apache with only one ip?

Post by Red Jacks » Thu, 13 Jul 2000 04:00:00


Hi!
did you reload/restart the server?

The example below will work -

NameVirtualHost 123.123.123.123

<Virtual Host 123.123.123.123>
    ServerName www.bigdomain.com
    DocumentRoot /home/httpd/bigdomain.com
</VirtualHost>

<Virtual Host 123.123.123.123>
    ServerName www.littledomian.com
    DocumentRoot /home/httpd/littledomain.com
</VirtualHost>

I have 50 sites on a single IP.

Red Jackson
System Engineer
Cypress Communications

On Tue, 11 Jul 2000 03:02:31 -0400, Nico Zigouras


>Yes I tried the NameVirtualHost directive - it did not work - both domains
>still got the origianl domain home page.  Thanks for the pointers though.


>> Date: Tue, 11 Jul 2000 06:20:06 GMT

>> Newsgroups: comp.infosystems.www.servers.unix
>> Subject: Re: Virtual domains on Apache with only one ip?

>> Nico Zigouras wrote in comp.infosystems.www.servers.unix:
>> >Hello:

>> >Is there a way to run two domains ( a virtual domain ) off of Apache when
>> >you only have one ip?  My isp only can give me one.  I am running Apache
>> >(? version) on a Cobalt Linux server (some version of Redhat I
>> >think).  Thanks.

>> Yes, with the NameVirtualHost directive. Look it up in the docs.

>> --
>> Rafael Garcia-Suarez

 
 
 

Virtual domains on Apache with only one ip?

Post by Ronald Col » Thu, 07 Sep 2000 09:21:19


redone~nosp...@siteconnect.com (Red Jackson) writes:
> Hi!
> did you reload/restart the server?

> The example below will work -

> NameVirtualHost 123.123.123.123

> <Virtual Host 123.123.123.123>
>     ServerName www.bigdomain.com
>     DocumentRoot /home/httpd/bigdomain.com
> </VirtualHost>

> <Virtual Host 123.123.123.123>
>     ServerName www.littledomian.com
>     DocumentRoot /home/httpd/littledomain.com
> </VirtualHost>

> I have 50 sites on a single IP.

I've done exactly that.  Just have one problem.  The second
<VirtualHost> is unable to pick up the index.html at the DocumentRoot.

That is:
 <http://80caliber.com/>,
 <http://80caliber.com/index.html>, and
 <http://forte-intl.com/index.html>
all work, but
 <http://forte-intl.com/>
doesn't.

I've read the FAQ and the O'Reilly book until I couldn't stand it
anymore!

Here's my httpd.conf file:

##
## httpd.conf -- Apache HTTP server configuration file
##

#
# Based upon the NCSA server configuration files originally by Rob McCool.
#
# This is the main Apache server configuration file.  It contains the
# configuration directives that give the server its instructions.
# See <URL:http://www.apache.org/docs/> for detailed information about
# the directives.
#
# Do NOT simply read the instructions in here without understanding
# what they do.  They're here only as hints or reminders.  If you are unsure
# consult the online docs. You have been warned.  
#
# After this file is processed, the server will look for and process
# /usr/conf/srm.conf and then /usr/conf/access.conf
# unless you have overridden these with ResourceConfig and/or
# AccessConfig directives here.
#
# The configuration directives are grouped into three basic sections:
#  1. Directives that control the operation of the Apache server process as a
#     whole (the 'global environment').
#  2. Directives that define the parameters of the 'main' or 'default' server,
#     which responds to requests that aren't handled by a virtual host.
#     These directives also provide default values for the settings
#     of all virtual hosts.
#  3. Settings for virtual hosts, which allow Web requests to be sent to
#     different IP addresses or hostnames and have them handled by the
#     same Apache server process.
#
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path.  If the filenames do *not* begin
# with "/", the value of ServerRoot is prepended -- so "logs/foo.log"
# with ServerRoot set to "/usr/local/apache" will be interpreted by the
# server as "/usr/local/apache/logs/foo.log".
#

### Section 1: Global Environment
#
# The directives in this section affect the overall operation of Apache,
# such as the number of concurrent requests it can handle or where it
# can find its configuration files.
#

#
# ServerType is either inetd, or standalone.  Inetd mode is only supported on
# Unix platforms.
#
ServerType standalone

#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# NOTE!  If you intend to place this on an NFS (or otherwise network)
# mounted filesystem then please read the LockFile documentation
# (available at <URL:http://www.apache.org/docs/mod/core.html#lockfile>);
# you will save yourself a lot of trouble.
#
# Do NOT add a slash at the end of the directory path.
#
ServerRoot "/etc/httpd"

#
# The LockFile directive sets the path to the lockfile used when Apache
# is compiled with either USE_FCNTL_SERIALIZED_ACCEPT or
# USE_FLOCK_SERIALIZED_ACCEPT. This directive should normally be left at
# its default value. The main reason for changing it is if the logs
# directory is NFS mounted, since the lockfile MUST BE STORED ON A LOCAL
# DISK. The PID of the main server process is automatically appended to
# the filename.
#
LockFile /var/lock/httpd.lock

#
# PidFile: The file in which the server should record its process
# identification number when it starts.
#
PidFile /var/run/httpd.pid

#
# ScoreBoardFile: File used to store internal server process information.
# Not all architectures require this.  But if yours does (you'll know because
# this file will be  created when you run Apache) then you *must* ensure that
# no two invocations of Apache share the same scoreboard file.
#
ScoreBoardFile /var/run/httpd.scoreboard

#
# In the standard configuration, the server will process this file,
# srm.conf, and access.conf in that order.  The latter two files are
# now distributed empty, as it is recommended that all directives
# be kept in a single file for simplicity.  The commented-out values
# below are the built-in defaults.  You can have the server ignore
# these files altogether by using "/dev/null" (for Unix) or
# "nul" (for Win32) for the arguments to the directives.
#
#ResourceConfig conf/srm.conf
#AccessConfig conf/access.conf

#
# Timeout: The number of seconds before receives and sends time out.
#
Timeout 300

#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive On

#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 100

#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 15

#
# Server-pool size regulation.  Rather than making you guess how many
# server processes you need, Apache dynamically adapts to the load it
# sees --- that is, it tries to maintain enough server processes to
# handle the current load, plus a few spare servers to handle transient
# load spikes (e.g., multiple simultaneous requests from a single
# Netscape browser).
#
# It does this by periodically checking how many servers are waiting
# for a request.  If there are fewer than MinSpareServers, it creates
# a new spare.  If there are more than MaxSpareServers, some of the
# spares die off.  The default values are probably OK for most sites.
#
MinSpareServers 5
MaxSpareServers 20

#
# Number of servers to start initially --- should be a reasonable ballpark
# figure.
#
StartServers 8

#
# Limit on total number of servers running, i.e., limit on the number
# of clients who can simultaneously connect --- if this limit is ever
# reached, clients will be LOCKED OUT, so it should NOT BE SET TOO LOW.
# It is intended mainly as a brake to keep a runaway server from taking
# the system with it as it spirals down...
#
MaxClients 150

#
# MaxRequestsPerChild: the number of requests each child process is
# allowed to process before the child dies.  The child will exit so
# as to avoid problems after prolonged use when Apache (and maybe the
# libraries it uses) leak memory or other resources.  On most systems, this
# isn't really needed, but a few (such as Solaris) do have notable leaks
# in the libraries. For these platforms, set to something like 10000
# or so; a setting of 0 means unlimited.
#
# NOTE: This value does not include keepalive requests after the initial
#       request per connection. For example, if a child process handles
#       an initial request and 10 subsequent "keptalive" requests, it
#       would only count as 1 request towards this limit.
#
MaxRequestsPerChild 100

#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, in addition to the default. See also the <VirtualHost>
# directive.
#
#Listen 3000
#Listen 12.34.56.78:80

#
# BindAddress: You can support virtual hosts with this option. This directive
# is used to tell the server which IP address to listen to. It can either
# contain "*", an IP address, or a fully qualified Internet domain name.
# See also the <VirtualHost> and Listen directives.
#
#BindAddress *

#
# Dynamic Shared Object (DSO) Support
#
# To be able to use the functionality of a module which was built as a DSO you
# have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are actually available _before_ they are used.
# Please read the file README.DSO in the Apache 1.3 distribution for more
# details about the DSO mechanism and run `httpd -l' for the list of already
# built-in (statically linked and thus always available) modules in your httpd
# binary.
#
# Note: The order is which modules are loaded is important.  Don't change
# the order below without expert advice.
#
# Example:
# LoadModule foo_module modules/mod_foo.so
#LoadModule mmap_static_module modules/mod_mmap_static.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule env_module         modules/mod_env.so
LoadModule config_log_module  modules/mod_log_config.so
LoadModule agent_log_module   modules/mod_log_agent.so
LoadModule referer_log_module modules/mod_log_referer.so
#LoadModule mime_magic_module  modules/mod_mime_magic.so
LoadModule mime_module        modules/mod_mime.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule status_module      modules/mod_status.so
LoadModule info_module        modules/mod_info.so
LoadModule includes_module    modules/mod_include.so
LoadModule autoindex_module   modules/mod_autoindex.so
LoadModule dir_module         modules/mod_dir.so
LoadModule cgi_module         modules/mod_cgi.so
LoadModule asis_module        modules/mod_asis.so
LoadModule imap_module        modules/mod_imap.so
LoadModule action_module      modules/mod_actions.so
#LoadModule speling_module     modules/mod_speling.so
LoadModule userdir_module     modules/mod_userdir.so
LoadModule alias_module       modules/mod_alias.so
LoadModule rewrite_module     modules/mod_rewrite.so
LoadModule access_module      modules/mod_access.so
LoadModule auth_module        modules/mod_auth.so
LoadModule anon_auth_module   modules/mod_auth_anon.so
LoadModule db_auth_module    
...

read more »