Welcome to MobyThreads.com!
FAQFAQ   SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in
All support for the MobyThreads Threaded phpBB MOD can now be found on welsolutions at this forum

Apache domain best practice??

 
   Web Hosting and Web Master Forums (Home) -> Apache RSS
Related Topics:
Multiple Site Config Apache 1.3.X "Best Practice?" - What is the 'best practice' for hosting multiple Apache 1.3.X web sites (actuall around 10 small on a single (large) Unix (HP-UX) server? This is a web server in a corporate with multiple teams sharing it. We want..

Apache virtual server setup and management best practice? - I know this is probably a little off topic but I figured it was the best place to ask.. I want to setup a few apache name based virtial servers.. I want my directory structure as follows.. html ..

apache not recieving for particular domain. - I have a number of domain names pointing to my All of which use the same virtual host with host *>. One of them has stopped any html and it appears is not being recieved by the I can't for the life of me figure..

Apache 2 and sub-domain setup - Ok I have what I think is a pretty darn nice basic setup of Windows 2000 Adv Server with the Apache 2.0.46 on top of it with all the goodies -Python, SSL, Perl, PHP, etc of the Apache Triad package - terriffic package) and I have my domain of..

apache domain alias - OK thank for help for set up the vhosts it started works there is a problem with alias when i type with a browser is ok is ok because I put but when i type is ok..
Next:  Migrating Servers  
Author Message
trpost

External


Since: Oct 22, 2007
Posts: 3



(Msg. 1) Posted: Mon Oct 22, 2007 4:53 pm
Post subject: Apache domain best practice??
Archived from groups: alt>apache>configuration (more info?)

I have an apache 2.0.54 webserver that I want to setup to handle 10
small domains. In the past I have setup each domain to listen on port
80, but burned a virtual ip in doing so. If possible I want to move
away from assigning a virtual ip to each new domain. I tried setting
up each domain using the same ip, but a different port i.e. 80, 8080,
8081, etc, however am having trouble with users then having to access
the URL with the port i.e. www.testabc.com:8081

What is the best way or best practice when setting up an apache
webserver to handle multiple domains,

Thanks!

 >> Stay informed about: Apache domain best practice?? 
Back to top
Login to vote
trpost

External


Since: Oct 22, 2007
Posts: 3



(Msg. 2) Posted: Mon Oct 22, 2007 5:21 pm
Post subject: Re: Apache domain best practice?? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Oct 22, 6:10 pm, shimmyshack <matt.fa....DeleteThis@gmail.com> wrote:
> trp....DeleteThis@gmail.com wrote:
> > I have an apache 2.0.54 webserver that I want to setup to handle 10
> > small domains. In the past I have setup each domain to listen on port
> > 80, but burned a virtual ip in doing so. If possible I want to move
> > away from assigning a virtual ip to each new domain. I tried setting
> > up each domain using the same ip, but a different port i.e. 80, 8080,
> > 8081, etc, however am having trouble with users then having to access
> > the URL with the port i.e.www.testabc.com:8081
>
> > What is the best way or best practice when setting up an apache
> > webserver to handle multiple domains,
>
> > Thanks!
>
> use a single IP!!
> this is virtualhosting
>
> set you apache to listen on port 80
>
> then HTTP/1.1 (what every modern user agent uses) sends a host header
>
> host:www.bbc.co.uk
>
> in the request, this is passed to apache which therefore knows what
> the browser is looking for, and you set rules in virtualhost stanzas
> that tell apache where each host is
>
> the first virtualhost stanza is always used when no other host header
> matches any other virtualhost block so it tends to make sense to have
> the first virtualhost a generic one
>
> see apache docs under virtualhosting
>
> <VirtualHost *>
> DocumentRoot /var/www/generic_not_found/public
> </VirtualHost>
>
> <VirtualHost *>
> DocumentRoot /var/www/example.com/public
> ServerNamewww.example.com
> ServerAlias example.com
> </VirtualHost>
>
> #etc...

Thanks for the quick response... Just to make sure I understand, would
this work for example:

<VirtualHost *>
DocumentRoot /var/www/generic_not_found/public
</VirtualHost>

<VirtualHost *>
DocumentRoot /var/www/example.com/public
ServerName www.example.com
ServerAlias example.com
</VirtualHost>

<VirtualHost *>
DocumentRoot /var/www/test.com/public
ServerName www.test.com
ServerAlias test.com
</VirtualHost>

<VirtualHost *>
DocumentRoot /var/www/project.com/public
ServerName www.project.com
ServerAlias project.com
</VirtualHost>

....

So in the above I am listening on port 80 and 1 ip address, but
handling 3 different domains based on the ServerName in the
VirtualHost definition. I guess I was thrown off a bit because what I
gathered in the docs was that I could use the same ip, but only for
subdomains, where here I actually have different domains.

 >> Stay informed about: Apache domain best practice?? 
Back to top
Login to vote
shimmyshack

External


Since: Jun 07, 2007
Posts: 70



(Msg. 3) Posted: Tue Oct 23, 2007 12:10 am
Post subject: Re: Apache domain best practice?? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

trp....RemoveThis@gmail.com wrote:
> I have an apache 2.0.54 webserver that I want to setup to handle 10
> small domains. In the past I have setup each domain to listen on port
> 80, but burned a virtual ip in doing so. If possible I want to move
> away from assigning a virtual ip to each new domain. I tried setting
> up each domain using the same ip, but a different port i.e. 80, 8080,
> 8081, etc, however am having trouble with users then having to access
> the URL with the port i.e. www.testabc.com:8081
>
> What is the best way or best practice when setting up an apache
> webserver to handle multiple domains,
>
> Thanks!


use a single IP!!
this is virtualhosting

set you apache to listen on port 80

then HTTP/1.1 (what every modern user agent uses) sends a host header

host: www.bbc.co.uk

in the request, this is passed to apache which therefore knows what
the browser is looking for, and you set rules in virtualhost stanzas
that tell apache where each host is


the first virtualhost stanza is always used when no other host header
matches any other virtualhost block so it tends to make sense to have
the first virtualhost a generic one

see apache docs under virtualhosting

<VirtualHost *>
DocumentRoot /var/www/generic_not_found/public
</VirtualHost>

<VirtualHost *>
DocumentRoot /var/www/example.com/public
ServerName www.example.com
ServerAlias example.com
</VirtualHost>

#etc...
 >> Stay informed about: Apache domain best practice?? 
Back to top
Login to vote
shimmyshack

External


Since: Jun 07, 2007
Posts: 70



(Msg. 4) Posted: Tue Oct 23, 2007 11:27 am
Post subject: Re: Apache domain best practice?? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Oct 23, 1:21 am, trp....TakeThisOut@gmail.com wrote:
> On Oct 22, 6:10 pm, shimmyshack <matt.fa....TakeThisOut@gmail.com> wrote:
>
>
>
>
>
> > trp....TakeThisOut@gmail.com wrote:
> > > I have an apache 2.0.54 webserver that I want to setup to handle 10
> > > small domains. In the past I have setup each domain to listen on port
> > > 80, but burned a virtual ip in doing so. If possible I want to move
> > > away from assigning a virtual ip to each new domain. I tried setting
> > > up each domain using the same ip, but a different port i.e. 80, 8080,
> > > 8081, etc, however am having trouble with users then having to access
> > > the URL with the port i.e.www.testabc.com:8081
>
> > > What is the best way or best practice when setting up an apache
> > > webserver to handle multiple domains,
>
> > > Thanks!
>
> > use a single IP!!
> > this is virtualhosting
>
> > set you apache to listen on port 80
>
> > then HTTP/1.1 (what every modern user agent uses) sends a host header
>
> > host:www.bbc.co.uk
>
> > in the request, this is passed to apache which therefore knows what
> > the browser is looking for, and you set rules in virtualhost stanzas
> > that tell apache where each host is
>
> > the first virtualhost stanza is always used when no other host header
> > matches any other virtualhost block so it tends to make sense to have
> > the first virtualhost a generic one
>
> > see apache docs under virtualhosting
>
> > <VirtualHost *>
> > DocumentRoot /var/www/generic_not_found/public
> > </VirtualHost>
>
> > <VirtualHost *>
> > DocumentRoot /var/www/example.com/public
> > ServerNamewww.example.com
> > ServerAlias example.com
> > </VirtualHost>
>
> > #etc...
>
> Thanks for the quick response... Just to make sure I understand, would
> this work for example:
>
> <VirtualHost *>
> DocumentRoot /var/www/generic_not_found/public
> </VirtualHost>
>
> <VirtualHost *>
> DocumentRoot /var/www/example.com/public
> ServerNamewww.example.com
> ServerAlias example.com
> </VirtualHost>
>
> <VirtualHost *>
> DocumentRoot /var/www/test.com/public
> ServerNamewww.test.com
> ServerAlias test.com
> </VirtualHost>
>
> <VirtualHost *>
> DocumentRoot /var/www/project.com/public
> ServerNamewww.project.com
> ServerAlias project.com
> </VirtualHost>
>
> ...
>
> So in the above I am listening on port 80 and 1 ip address, but
> handling 3 different domains based on the ServerName in the
> VirtualHost definition. I guess I was thrown off a bit because what I
> gathered in the docs was that I could use the same ip, but only for
> subdomains, where here I actually have different domains.- Hide quoted text -
>
> - Show quoted text -

yup it sure would, with the caveat that you have to tell apache that
its now in namevirtualhost mode. (you can keep the ip aliasing the way
you had it) because apache listens on all ip addresses if you dont
specify less (*:80) means listen on port 80 on all IPs, so
<VirtualHost *> will work with your existing setup.

NameVirtualHost *:80
#or NameVirtualHost *
#or NameVirtualHost 10.10.10.12:80 ....
#depending on what you need.



<VirtualHost *>
DocumentRoot /var/www/generic_not_found/public
</VirtualHost>

<VirtualHost *>
DocumentRoot /var/www/example.com/public
ServerName www.example.com
ServerAlias example.com
</VirtualHost>

<VirtualHost *>
DocumentRoot /var/www/test.com/public
ServerName www.test.com
ServerAlias test.com
</VirtualHost>

<VirtualHost *>
DocumentRoot /var/www/project.com/public
ServerName www.project.com
ServerAlias project.com
</VirtualHost>





--------------------------
because you will probably only be using port 80 you could use this as
well:
<VirtualHost *:80>
DocumentRoot /var/www/generic_not_found/public
</VirtualHost>
or even
<VirtualHost 10.10.10.12:80>
DocumentRoot /var/www/generic_not_found/public
</VirtualHost>

see its easy.

you can now try on the command line
telnet your_server_ ip 80

then copy this to the clipboard and simply paste in the command line
and press enter twice

GET / HTTP/1.1
host: www.project.com

or

GET / HTTP/1.1
host: project.com



you will be served the default index from the www.project.com/
project.com site,

or

GET / HTTP/1.1
host: 127.0.0.1

will not match any, so it will served from the first vhost stanza,
which is why having a catch all is useful - in case people use an OLD
or user agent not compliant with HTTP/1.1 or miss off the host header
in code you could consider writing
"you must use an HTTP/1.1 sompliant user agent to view content on this
server" mesage for the catch all vhost



you can also use more advanced mass virtual hosting, which requires
only that you create the file system structure, for the new host to
work, its therefore called dynamic mass virtual hosting.
http://httpd.apache.org/docs/2.2/mod/mod_vhost_alias.html
 >> Stay informed about: Apache domain best practice?? 
Back to top
Login to vote
trpost

External


Since: Oct 22, 2007
Posts: 3



(Msg. 5) Posted: Tue Oct 30, 2007 9:12 am
Post subject: Re: Apache domain best practice?? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Oct 23, 5:27 am, shimmyshack <matt.fa....DeleteThis@gmail.com> wrote:
> On Oct 23, 1:21 am, trp....DeleteThis@gmail.com wrote:
>
>
>
>
>
> > On Oct 22, 6:10 pm, shimmyshack <matt.fa....DeleteThis@gmail.com> wrote:
>
> > > trp....DeleteThis@gmail.com wrote:
> > > > I have an apache 2.0.54 webserver that I want to setup to handle 10
> > > > small domains. In the past I have setup each domain to listen on port
> > > > 80, but burned a virtual ip in doing so. If possible I want to move
> > > > away from assigning a virtual ip to each new domain. I tried setting
> > > > up each domain using the same ip, but a different port i.e. 80, 8080,
> > > > 8081, etc, however am having trouble with users then having to access
> > > > the URL with the port i.e.www.testabc.com:8081
>
> > > > What is the best way or best practice when setting up an apache
> > > > webserver to handle multiple domains,
>
> > > > Thanks!
>
> > > use a single IP!!
> > > this is virtualhosting
>
> > > set you apache to listen on port 80
>
> > > then HTTP/1.1 (what every modern user agent uses) sends a host header
>
> > > host:www.bbc.co.uk
>
> > > in the request, this is passed to apache which therefore knows what
> > > the browser is looking for, and you set rules in virtualhost stanzas
> > > that tell apache where each host is
>
> > > the first virtualhost stanza is always used when no other host header
> > > matches any other virtualhost block so it tends to make sense to have
> > > the first virtualhost a generic one
>
> > > see apache docs under virtualhosting
>
> > > <VirtualHost *>
> > > DocumentRoot /var/www/generic_not_found/public
> > > </VirtualHost>
>
> > > <VirtualHost *>
> > > DocumentRoot /var/www/example.com/public
> > > ServerNamewww.example.com
> > > ServerAlias example.com
> > > </VirtualHost>
>
> > > #etc...
>
> > Thanks for the quick response... Just to make sure I understand, would
> > this work for example:
>
> > <VirtualHost *>
> > DocumentRoot /var/www/generic_not_found/public
> > </VirtualHost>
>
> > <VirtualHost *>
> > DocumentRoot /var/www/example.com/public
> > ServerNamewww.example.com
> > ServerAlias example.com
> > </VirtualHost>
>
> > <VirtualHost *>
> > DocumentRoot /var/www/test.com/public
> > ServerNamewww.test.com
> > ServerAlias test.com
> > </VirtualHost>
>
> > <VirtualHost *>
> > DocumentRoot /var/www/project.com/public
> > ServerNamewww.project.com
> > ServerAlias project.com
> > </VirtualHost>
>
> > ...
>
> > So in the above I am listening on port 80 and 1 ip address, but
> > handling 3 different domains based on the ServerName in the
> > VirtualHost definition. I guess I was thrown off a bit because what I
> > gathered in the docs was that I could use the same ip, but only for
> > subdomains, where here I actually have different domains.- Hide quoted text -
>
> > - Show quoted text -
>
> yup it sure would, with the caveat that you have to tell apache that
> its now in namevirtualhost mode. (you can keep the ip aliasing the way
> you had it) because apache listens on all ip addresses if you dont
> specify less (*:80) means listen on port 80 on all IPs, so
> <VirtualHost *> will work with your existing setup.
>
> NameVirtualHost *:80
> #or NameVirtualHost *
> #or NameVirtualHost 10.10.10.12:80 ....
> #depending on what you need.
>
> <VirtualHost *>
> DocumentRoot /var/www/generic_not_found/public
> </VirtualHost>
>
> <VirtualHost *>
> DocumentRoot /var/www/example.com/public
> ServerNamewww.example.com
> ServerAlias example.com
> </VirtualHost>
>
> <VirtualHost *>
> DocumentRoot /var/www/test.com/public
> ServerNamewww.test.com
> ServerAlias test.com
> </VirtualHost>
>
> <VirtualHost *>
> DocumentRoot /var/www/project.com/public
> ServerNamewww.project.com
> ServerAlias project.com
> </VirtualHost>
>
> --------------------------
> because you will probably only be using port 80 you could use this as
> well:
> <VirtualHost *:80>
> DocumentRoot /var/www/generic_not_found/public
> </VirtualHost>
> or even
> <VirtualHost 10.10.10.12:80>
> DocumentRoot /var/www/generic_not_found/public
> </VirtualHost>
>
> see its easy.
>
> you can now try on the command line
> telnet your_server_ ip 80
>
> then copy this to the clipboard and simply paste in the command line
> and press enter twice
>
> GET / HTTP/1.1
> host:www.project.com
>
> or
>
> GET / HTTP/1.1
> host: project.com
>
> you will be served the default index from thewww.project.com/
> project.com site,
>
> or
>
> GET / HTTP/1.1
> host: 127.0.0.1
>
> will not match any, so it will served from the first vhost stanza,
> which is why having a catch all is useful - in case people use an OLD
> or user agent not compliant with HTTP/1.1 or miss off the host header
> in code you could consider writing
> "you must use an HTTP/1.1 sompliant user agent to view content on this
> server" mesage for the catch all vhost
>
> you can also use more advanced mass virtual hosting, which requires
> only that you create the file system structure, for the new host to
> work, its therefore called dynamic mass virtual hosting.http://httpd.apache.org/docs/2.2/mod/mod_vhost_alias.html- Hide quoted text -
>
> - Show quoted text -

So I got this to work fine for port 80, however read that port 443 SSL
does not work well with named virtual hosts. What is the best practice
in this case?
 >> Stay informed about: Apache domain best practice?? 
Back to top
Login to vote
shimmyshack

External


Since: Jun 07, 2007
Posts: 70



(Msg. 6) Posted: Thu Nov 01, 2007 3:00 pm
Post subject: Re: Apache domain best practice?? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Oct 30, 4:12 pm, trp....DeleteThis@gmail.com wrote:
> On Oct 23, 5:27 am, shimmyshack <matt.fa....DeleteThis@gmail.com> wrote:
>
>
>
>
>
> > On Oct 23, 1:21 am, trp....DeleteThis@gmail.com wrote:
>
> > > On Oct 22, 6:10 pm, shimmyshack <matt.fa....DeleteThis@gmail.com> wrote:
>
> > > > trp....DeleteThis@gmail.com wrote:
> > > > > I have an apache 2.0.54 webserver that I want to setup to handle 10
> > > > > small domains. In the past I have setup each domain to listen on port
> > > > > 80, but burned a virtual ip in doing so. If possible I want to move
> > > > > away from assigning a virtual ip to each new domain. I tried setting
> > > > > up each domain using the same ip, but a different port i.e. 80, 8080,
> > > > > 8081, etc, however am having trouble with users then having to access
> > > > > the URL with the port i.e.www.testabc.com:8081
>
> > > > > What is the best way or best practice when setting up an apache
> > > > > webserver to handle multiple domains,
>
> > > > > Thanks!
>
> > > > use a single IP!!
> > > > this is virtualhosting
>
> > > > set you apache to listen on port 80
>
> > > > then HTTP/1.1 (what every modern user agent uses) sends a host header
>
> > > > host:www.bbc.co.uk
>
> > > > in the request, this is passed to apache which therefore knows what
> > > > the browser is looking for, and you set rules in virtualhost stanzas
> > > > that tell apache where each host is
>
> > > > the first virtualhost stanza is always used when no other host header
> > > > matches any other virtualhost block so it tends to make sense to have
> > > > the first virtualhost a generic one
>
> > > > see apache docs under virtualhosting
>
> > > > <VirtualHost *>
> > > > DocumentRoot /var/www/generic_not_found/public
> > > > </VirtualHost>
>
> > > > <VirtualHost *>
> > > > DocumentRoot /var/www/example.com/public
> > > > ServerNamewww.example.com
> > > > ServerAlias example.com
> > > > </VirtualHost>
>
> > > > #etc...
>
> > > Thanks for the quick response... Just to make sure I understand, would
> > > this work for example:
>
> > > <VirtualHost *>
> > > DocumentRoot /var/www/generic_not_found/public
> > > </VirtualHost>
>
> > > <VirtualHost *>
> > > DocumentRoot /var/www/example.com/public
> > > ServerNamewww.example.com
> > > ServerAlias example.com
> > > </VirtualHost>
>
> > > <VirtualHost *>
> > > DocumentRoot /var/www/test.com/public
> > > ServerNamewww.test.com
> > > ServerAlias test.com
> > > </VirtualHost>
>
> > > <VirtualHost *>
> > > DocumentRoot /var/www/project.com/public
> > > ServerNamewww.project.com
> > > ServerAlias project.com
> > > </VirtualHost>
>
> > > ...
>
> > > So in the above I am listening on port 80 and 1 ip address, but
> > > handling 3 different domains based on the ServerName in the
> > > VirtualHost definition. I guess I was thrown off a bit because what I
> > > gathered in the docs was that I could use the same ip, but only for
> > > subdomains, where here I actually have different domains.- Hide quoted text -
>
> > > - Show quoted text -
>
> > yup it sure would, with the caveat that you have to tell apache that
> > its now in namevirtualhost mode. (you can keep the ip aliasing the way
> > you had it) because apache listens on all ip addresses if you dont
> > specify less (*:80) means listen on port 80 on all IPs, so
> > <VirtualHost *> will work with your existing setup.
>
> > NameVirtualHost *:80
> > #or NameVirtualHost *
> > #or NameVirtualHost 10.10.10.12:80 ....
> > #depending on what you need.
>
> > <VirtualHost *>
> > DocumentRoot /var/www/generic_not_found/public
> > </VirtualHost>
>
> > <VirtualHost *>
> > DocumentRoot /var/www/example.com/public
> > ServerNamewww.example.com
> > ServerAlias example.com
> > </VirtualHost>
>
> > <VirtualHost *>
> > DocumentRoot /var/www/test.com/public
> > ServerNamewww.test.com
> > ServerAlias test.com
> > </VirtualHost>
>
> > <VirtualHost *>
> > DocumentRoot /var/www/project.com/public
> > ServerNamewww.project.com
> > ServerAlias project.com
> > </VirtualHost>
>
> > --------------------------
> > because you will probably only be using port 80 you could use this as
> > well:
> > <VirtualHost *:80>
> > DocumentRoot /var/www/generic_not_found/public
> > </VirtualHost>
> > or even
> > <VirtualHost 10.10.10.12:80>
> > DocumentRoot /var/www/generic_not_found/public
> > </VirtualHost>
>
> > see its easy.
>
> > you can now try on the command line
> > telnet your_server_ ip 80
>
> > then copy this to the clipboard and simply paste in the command line
> > and press enter twice
>
> > GET / HTTP/1.1
> > host:www.project.com
>
> > or
>
> > GET / HTTP/1.1
> > host: project.com
>
> > you will be served the default index from thewww.project.com/
> > project.com site,
>
> > or
>
> > GET / HTTP/1.1
> > host: 127.0.0.1
>
> > will not match any, so it will served from the first vhost stanza,
> > which is why having a catch all is useful - in case people use an OLD
> > or user agent not compliant with HTTP/1.1 or miss off the host header
> > in code you could consider writing
> > "you must use an HTTP/1.1 sompliant user agent to view content on this
> > server" mesage for the catch all vhost
>
> > you can also use more advanced mass virtual hosting, which requires
> > only that you create the file system structure, for the new host to
> > work, its therefore called dynamic mass virtual hosting.http://httpd.apache.org/docs/2.2/mod/mod_vhost_alias.html-Hide quoted text -
>
> > - Show quoted text -
>
> So I got this to work fine for port 80, however read that port 443 SSL
> does not work well with named virtual hosts. What is the best practice
> in this case?- Hide quoted text -
>
> - Show quoted text -

well you can create a signature for multiple hosts using cacert.org
 >> Stay informed about: Apache domain best practice?? 
Back to top
Login to vote
Display posts from previous:   
   Web Hosting and Web Master Forums (Home) -> Apache All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]