Settings up additional 'http://localhosts' (ie. localhost2, localhost3) in apache

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts

  • Gordon Burditt
    Guest replied
    Re: Settings up additional 'http://localhosts' (ie. localhost2, localhost3) in apache

    >> Edit your HOSTS file. You will find it in[color=blue][color=green]
    >> C:\Windows\Syst em32\Drivers\Et c\.[/color]
    >
    >your HOSTS probly says
    >127.0.0.1 localhost
    >
    >below it, add
    >127.0.0.2 site2
    >
    >goto your httpd.conf (in apache's dir, or somewhere nearby)
    >look for this (around line 150) : Listen 127.0.0.1:80 or something like
    >it. under it, add
    >Listen 127.0.0.2:80
    >
    >near the bottom of httpd.conf, look for the virtualHost stuff. add this
    >under whatever is there:
    ><VirtualHost 127.0.0.2:80>
    >ServerName site2
    >DocumentRoot "C:/My Documents/_websites/folderforSite2/www/"
    ></VirtualHost>
    >
    >Thats what I do, I have a test host for 23 sites that way, just adding
    >1 to the IP each time. If there are less steps i could take, I'd like
    >to know![/color]

    There are two methods of having Apache handle multiple sites on the
    same server. The one you indicate requires multiple IPs on the
    server. While you aren't likely to run out of IPs for localhost
    any time soon (you've got about 16 million of them), running out
    of public IPs can be a real problem, especially if you're on a DSL
    line which only gives you one. Using up a whole class C (253 usable
    addresses) or more for one web hosting company web server is a bit
    of a waste.

    The other method of doing virtualhosting is to put them all on the
    same IP address (and the same port). The browser, except for those
    that are SERIOUSLY out of date (and were seriously out of date in
    2000), such as Netscape 2.*) will send a Host: header with the
    request, indicating which host name it was for. Apache will sort
    out which virtualhost is being addressed from the host name. If
    you send it a host name it doesn't recognize, you'll get a default
    site. Read the Apache manual for more details. You *need* to have
    working DNS (or edit the HOSTS file) since putting in an IP address
    to the browser will not let the browser know which site you want.

    Gordon L. Burditt

    Leave a comment:


  • Stan McCann
    Guest replied
    Re: Settings up additional 'http://localhosts' (ie. localhost2, localhost3) in apache

    "bizt" <bissatch@yahoo .co.uk> wrote in
    news:1132750126 .781719.40630@g 43g2000cwa.goog legroups.com:
    [color=blue]
    > Hi,
    >
    > My knowledge of apache is nothing impressive,. I purely use it to
    > run local websites. I was wondering however, if it is possible to
    > create more local domains like localhost. I like my local websites
    > to be able to run in a simulated environment as my remote host. This
    > would maybe run like http://localhost, http://localhost2,
    > http://localhost3 ...
    >
    > Can it be done? Btw, Im running apache on Windows.[/color]

    Just add the domain names you wish to use in your hosts file
    (\windows\syste m32\drivers\etc IIRC), then comes the tricky part if
    you want to use more than one simultaneously. Study up on virtual
    hosting for apache. It will allow you to run more than one
    site(domain name) from the same server.

    I serve 5 sites (stanmccann.us in my sig is just one of them) from my
    little Linux box at home, then I also have test.org available to all
    machines on my LAN. An added benefit of this method is I *can* access
    test.org from anywhere by setting it in the local hosts file.

    --
    Stan McCann "Uncle Pirate" http://stanmccann.us/pirate.html
    Webmaster/Computer Center Manager, NMSU at Alamogordo
    http://alamo.nmsu.edu/ There are 10 kinds of people.
    Those that understand binary and those that don't.

    Leave a comment:


  • juglesh
    Guest replied
    Re: Settings up additional 'http://localhosts' (ie. localhost2, localhost3) in apache


    Chung Leong wrote:[color=blue]
    > Edit your HOSTS file. You will find it in
    > C:\Windows\Syst em32\Drivers\Et c\.[/color]

    your HOSTS probly says
    127.0.0.1 localhost

    below it, add
    127.0.0.2 site2

    goto your httpd.conf (in apache's dir, or somewhere nearby)
    look for this (around line 150) : Listen 127.0.0.1:80 or something like
    it. under it, add
    Listen 127.0.0.2:80

    near the bottom of httpd.conf, look for the virtualHost stuff. add this
    under whatever is there:
    <VirtualHost 127.0.0.2:80>
    ServerName site2
    DocumentRoot "C:/My Documents/_websites/folderforSite2/www/"
    </VirtualHost>

    Thats what I do, I have a test host for 23 sites that way, just adding
    1 to the IP each time. If there are less steps i could take, I'd like
    to know!

    --
    j

    Leave a comment:


  • Gordon Burditt
    Guest replied
    Re: Settings up additional 'http://localhosts' (ie. localhost2, localhost3) in apache

    >My knowledge of apache is nothing impressive,. I purely use it to run[color=blue]
    >local websites. I was wondering however, if it is possible to create
    >more local domains like localhost. I like my local websites to be able
    >to run in a simulated environment as my remote host. This would maybe
    >run like http://localhost, http://localhost2, http://localhost3 ...
    >
    >Can it be done? Btw, Im running apache on Windows.[/color]

    If you have access to DNS (e.g. you run a nameserver on your machine
    or your LAN), you can point additional names (preferably ones not
    in use by someone else, say, using the top-level domain ".local",
    which will likely never be used on the global Internet), at 127.0.0.1
    or the IP address of your server machine, then configure them as
    virtual hosts in Apache. This will be seen only by hosts that use
    your nameserver.

    If you don't have access to DNS, you can do the same thing with the
    HOSTS file on all the machines you want to have see the sites, then
    configure virtual hosts on Apache.

    Gordon L. Burditt

    Leave a comment:


  • Chung Leong
    Guest replied
    Re: Settings up additional 'http://localhosts' (ie. localhost2, localhost3) in apache

    Edit your HOSTS file. You will find it in
    C:\Windows\Syst em32\Drivers\Et c\.

    Leave a comment:


  • Jerry Stuckle
    Guest replied
    Re: Settings up additional 'http://localhosts' (ie. localhost2, localhost3)in apache

    bizt wrote:[color=blue]
    > Hi,
    >
    > My knowledge of apache is nothing impressive,. I purely use it to run
    > local websites. I was wondering however, if it is possible to create
    > more local domains like localhost. I like my local websites to be able
    > to run in a simulated environment as my remote host. This would maybe
    > run like http://localhost, http://localhost2, http://localhost3 ...
    >
    > Can it be done? Btw, Im running apache on Windows.
    >
    > Burnsy
    >[/color]

    How about asking in an Apache newsgroup? Or, the Apache users maillist
    is even better.

    --
    =============== ===
    Remove the "x" from my email address
    Jerry Stuckle
    JDS Computer Training Corp.
    jstucklex@attgl obal.net
    =============== ===

    Leave a comment:


  • Settings up additional 'http://localhosts' (ie. localhost2, localhost3) in apache

    Hi,

    My knowledge of apache is nothing impressive,. I purely use it to run
    local websites. I was wondering however, if it is possible to create
    more local domains like localhost. I like my local websites to be able
    to run in a simulated environment as my remote host. This would maybe
    run like http://localhost, http://localhost2, http://localhost3 ...

    Can it be done? Btw, Im running apache on Windows.

    Burnsy

Working...