Does Apache Virtual Hosting work with localhost?

I'm a newbie trying to learn how apache web server works. I've activated apache web server on my Mac PowerBook G4, and tweaked the config file to get PHP, SSI and CGI working.
If I type the url http://127.0.0.1/ I get the same page as http://localhost/
If localhost is the domain name for the address 127.0.0.1, can I assign other domain names to 127.0.0.1 using apache's virtual hosting?
Ti Powerbook G4   Mac OS X (10.4.4)  

localhost is defined as 127.0.0.1. You can use them interchangeably.
As for virtual hosts, sure. Apache doesn't care.
There are two ways of running virtual hosts.
Port-based virtual hosts use a port number other than the standard 80. They can be accessed via something like http://localhost:8000/
Name-based virtual hosts look at the hostname header in the request to work out which site to serve. You can run any number of sites on the same port number this way, but you need to be able to control DNS so that it points to your machine.
If you are just testing this locally you can edit /etc/hosts to add whatever hostnames you like;
127.0.0.1 localhost my.testsite.com me.mydomain.com
Now when you enter 'my.testsite.com' or 'my.mydomain.com' in your web browser, /etc/hosts will resolve this to 127.0.0.1 and you'll talk to your local apache server.
Note that the localhost entries don't have to be in your domain. You can use this to override any real hostname you like.
Of course, if you want remote users to access this site you'll need to setup something in the DNS, or edit their /etc/hosts files individually.

Similar Messages

  • Struggling with Apache Virtual Hosts

    Hi Folks,
    I'm having trouble getting Apache virtual hosts to function
    on my work PC.
    PHP works. The PHP info page loads fine. I just can't get any
    virtual hosts
    to function. Get "Cannot find server or DNS Error."
    The identical configuration on my home machine works fine.
    Some details
    below.
    Windows HOSTS file:
    127.0.0.1 localhost
    127.0.0.1 mvhms
    Apache 2.0 virtual host settings in httpd.conf file:
    # Use name-based virtual hosting.
    NameVirtualHost *:80
    # Edited by Phil 3/15/2007
    <VirtualHost *:80>
    DocumentRoot c:/htdocs
    ServerName localhost
    </VirtualHost>
    <VirtualHost *:80>
    DocumentRoot c:/htdocs/mvhms
    ServerName mvhms
    </VirtualHost>
    Any help greatly appreciated. Thanks.
    Phil
    Work PC is on a LAN
    Windows XP Pro
    Apache 2.0.59
    PHP 5.1.6
    Reference: PHP for Dreamweaver 8

    Hi Bev,
    I tried various local IP addresses with no luck.
    However, I do think it may be a local LAN or HOSTS file
    issue. If I remove
    the proper references from my home HOSTS file, I get the
    identical behavior
    as my work machine.
    Is there a Windows HOSTS file bypass or Group Policy setting
    that our IT
    department may have changed?
    Phil
    "bsoliman" <[email protected]> wrote in
    message
    news:etcioa$839$[email protected]..
    > You're welcome, Phil.
    >
    > Hmmm, in that case then I'm stumped too. If the exact
    same setup is
    > working
    > for you at home, then I have a sneaking suspicion that
    it has something to
    > do
    > with being on a LAN. Unfortunately, that's just a gut
    instinct and I
    > couldn't
    > tell you what the acutal problem might be. Hopefully
    someone else will
    > come
    > along that can help you out.
    >
    > This is a total shot in the dark: Why not try changing
    127.0.0.1 to your
    > machine's IP address on the LAN? I'm obviously grabbing
    at straws here,
    > but I
    > figure trying something (no matter how farfetched) is
    better than sitting
    > around feeling aggravated while waiting for help :-)
    >

  • How to configure Apache Virtual Hosts?

    Hi, I was wondering, how does configure Apache virtual hosts for Mac OS X Client 10.4.5? At this time, I have added
    NameVirtualHost *:80
    <VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot /Library/WebServer/Documents/janus
    ServerName janus.php.test
    ErrorLog /private/var/log/httpd/janus.php.com-error_log
    CustomLog /private/var/log/httpd/janus.php.com-access_log common
    </VirtualHost>
    Finally, when I try to use the name in the browser, I get the following error message:
    Safari can’t find the server.
    Safari can’t open the page “http://janus.php.test/” because it can’t find the server “janus.php.test”.
    Well, I must go and thanks in advance.
    Peace,
    -Conrad

    If you want to use the fqdn you defined and can/do not want to register it as a Internet Domain you can add it to the hosts file in /etc/hosts if you are comfortable using terminal and the shell
    open a terminal
    and use the following commands
    cd /etc
    sudo vim hosts
    (you will be prompted for your password here, enter it and hit return)
    in vim scroll to the last line which will look like
    ::1 localhost
    type
    i
    (you are now in insert mode)
    type the following line
    192.168.0.15 janus.php.test
    (replace the ip address with the ip address of the host in question)
    hit Control-C
    type
    :w (vim will confirm in the last line)
    type
    :q
    you are back at the terminal
    test your new hosts file by typing
    ping janus.php.test
    Hope this helps
    Mike

  • PlsqlCGIEnvironmentList for multiple apache virtual host

    a question that's still related to the following thread
    APEX Charts - Error XML Loading falied
    APEX Charts - Error XML Loading falied
    Hi,
    I have multiple apache virtual host for my apex instance. I have trouble loading the flash chart in my virtual hosts.
    I followed the instruction on the above link, it works.
    PlsqlCGIEnvironmentList HTTP_HOST=<my friendly URL>:80
    My question is what if I have multiple virtual hosts?
    Has anyone done this before?
    Thanks.
    -Joel

    Hi Jari,
    You mean these parameter
    PlsqlCGIEnvironmentList SERVER_NAME=external.server.com
    PlsqlCGIEnvironmentList SERVER_PORT=80
    How are those different from HTTP_HOST and what if I have multiple host (virtual)?
    Cheers,
    -Joel

  • Is it possible to have your whole family on one apple id or is it better to have each person have there own? If each has their own does each id have to buy their own music and apps? How does find my iphone work with one apple id or two?

    Is it possible to have your whole family on one apple id or is it better to have each person have there own? If each has their own does each id have to buy their own music and apps? How does find my iphone work with one apple id or two? also I am going to be going off to college soon should I make an itunes id for my self and how will I get all the music from the old id?

    Is it possible to have your whole family on one apple id or is it better to have each person have there own?
    Yes, it is possible. 1 apple ID can be associated with up to 10 devices.
    If each has their own does each id have to buy their own music and apps?
    Yes, all purchases are non-transferable.
    How does find my iphone work with one apple id or two?
    Every device associated with one apple ID through Find my iPhone is tied to that Apple ID; Find my iPhone will work in the same way with up to ten devices associated with one apple ID. You cannot enable Find my iPhone for one device across two apple IDs
    I am going to be going off to college soon should I make an itunes id for my self and how will I get all the music from the old id?
    If you have authorized a computer with the old apple ID, you can transfer old media purchased through the old to other devices via iTunes. This doesn't mean the media purchases through the old apple ID it transferred to the new account. If you plan to make future purchases and don't wish to share them with others, make your own apple ID.

  • DOES THE APPLE REMOTE WORK WITH THE IPOD TOUCH..? WITHOUT A DOCK..

    HI
    DOES THE APPLE REMOTE WORK WITH THE IPOD TOUCH 5TH GEN..? WHITHOUT A DOCK..??
    THANKS ANYONE

    This Apple remote requires a dock since this remote uses IR and the iPod does not ha IR capibility,.
    Manufacturer Information
    Apple Remote with iPod and iPhone: Please note a Universal Dock is required in order to use the Apple Remote with your iPhone or iPod.
    http://store.apple.com/us/product/MC377LL/A/apple-remote?

  • Does the apple remote work with the ipod touch 4th gen?

    Does the apple remote work with the ipod touch 4th gen?

    Yes, but it also requires Apple's Universal Dock to go along with it.  Otherwise, it is useles.
    B-rock

  • HT201335 does the Ipod touch work with the airplay mirroring

    Does the Ipod touch work with airplay mirroring?

    No. Only iPhone 4S and iPad (2nd or 3rd Gen) as it requires more processing power. You can still use airplay with your device though.

  • Does the ipod video work with the original ihome?

    does the ipod video work with the original ihome?

    Welcome to Apple Discussions!
    If you mean this one...
    http://www.ihomeaudio.com/products.asp?productid=10015&deptid=1003
    Them yes. I am using one myself. You may want to purcahse these if it does not come with them (depending on how old it is)
    http://www.ihomeaudio.com/products.asp?productid=10016&deptid=1000
    btabz

  • Does the iPod Mini Work with Windows?

    I am thinking of buying an iPod mini but I don't have an Apple computer. Does the iPod mini work with Windows efficiently? Thanks....

    Hello Ian,
    Can you be really specific about the necessary Windows XP updates needed? I run XP Pro on a rather new computer and just got an IPOD mini. I'm ready to tear my hair out because iTunes seems to crash my computer every time I change one CD for another. iTunes runs REALLY, REALLY slow for me. Also read on the board that iTunes 6.0 and the mini don't work well together. True or not true?
    Thanks - Genevieve

  • Does the Ipod nano work with microsoft XP?

    Does the ipod nano work with MS windows XP? itunes will recognize my Nano 7G, therefor I cannot sync,

    Have you try putting your ipod into disk mode if you need help putting it in disk mode here's a page from apple
    of how to put your ipod nano into disk mode: http://support.apple.com/kb/ht1363

  • Does photoshop elements 13 work with windows vista?

    I have V10 and a Windows Vista PC that is fast and paid for,
    Thinking of purchasing new software from Adobe.
    Does photoshop elements 13 work with Windows Vista?

    No. Windows 7 or Windows 8.x only.
    System requirements | Adobe Photoshop Elements

  • Does Adobe Photoshop Elements work with MacBook Pro with Retina display?

    Does Adobe Photoshop Elements work with MacBook Pro with Retina display, please?
    Have searched Adobe website for answer - most recent is 2013 answer, saying no.
    Contradicted by a staff ember who only referred to Photoshop, not Elements.
    Reason I need it is that iPhoto does not support very high resolution photos - which I have now scanned onto my MacBook and do not want to re-scan!! After 90 minutes at my local Genius bar (lovely folk, very conscientiously searching for an answer...), re-scanning was their final piece of advice.
    Help, please...

    Hello Smis,
    Welcome to the HP Forums, I hope you enjoy your experience! To help you get the most out of the HP Forums I would like to direct your attention to the HP Forums Guide First Time Here? Learn How to Post and More.
    I understand you are having issues with your HP Monitor on your MAC. I am providing you with an HP Support document: Updating a Monitor Driver, where it states under the sub-heading Using HP monitors on a Mac "HP monitors are not supported in a Mac environment. However, newer Macs use graphics with VESA modes and can display to most HP LCD monitors. To do this, connect the monitor to the Mac while the Mac is off, and then turn on the MAC. The monitor should operate at 60Hz. The INF and software for the HP monitor are for Microsoft Windows and cannot be run in a standard MAC OS environment."
    This being said all I can advise is that you check to see that the monitor is set to operat at 60Hz and contact Apple for assistance if that does not get your monitor displaying correctly.
    I hope I have answered your question to your satisfaction. Thank you for posting on the HP Forums. Have a great day!
    Please click the "Thumbs Up" on the bottom right of this post to say thank you if you appreciate the support I provide!
    Also be sure to mark my post as “Accept as Solution" if you feel my post solved your issue, it will help others who face the same challenge find the same solution.
    Dunidar
    I work on behalf of HP
    Find out a bit more about me by checking out my profile!
    "Customers don’t expect you to be perfect. They do expect you to fix things when they go wrong." ~ Donald Porter

  • Why does my imessage not work with only 1 phone number

    Why does my imessage not work with only 1 phone number? It keeps going to imessage and then back to text message

    Both you and the recipient have to have active data connections, and both devices have to have iOS 5 or higher to be able to use iMessage. Also, they both have to have iMessage activated. If that is already the case, there is a possiblility that iMessage is down. It has gone up and down several times in the past week. Check this page for status, and if necessary you can report a problem with a link in the lower right corner. http://www.apple.com/support/icloud/systemstatus/

  • Why does flash player not work with facebook?

    Why does flash player not work with fcebook?  Whenever I wish to view a video, I get the message that i need to upgrade my flash player. Then no matter how often I download and install flash player I still get the message that I need to upgrade my flash player.  When I go check which version I have, I always get the message that I have the most current one.  I run Mozilla Firefox with Windows.  I don't know anything else.
    Message was edited by: khettich

    This means you don't have the latest version installed.  Update to 11.9.900.117, and Firefox will allow it: Flash Player Plug-in (All other browsers)

Maybe you are looking for

  • Not able to change the path to trusted keystore for connection to directory

    Hi, I am trying to make a secured connection to directory server through JNDI. env.put( Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory" if(isSSLEnabled){ env.put( Context.PROVIDER_URL, "ldap://" + host + ":" + securePort else{ env

  • Response.sendRedirect is not working for IE5.5

    Hi All, I am using response.sendRedirect method to go to different page from jsp file. It was working file before IE was upgraded to version 5.5. It is still working fine with Netscape. With IE, it remains on the same page even after executing respon

  • LCD replacement compatibility

    Howdy: I am about to replace the LCD in my PB 12" G4 DVI. Can I use the LCD from an iBook? Is there a range of LCD screens that will be compatible with the PB? The two computers have different part numbers for the display, but my hunch is that the LC

  • A way around F keys

    I am creating a simulation of a DOS system that still uses F keys to aid in system navigation. The simulations work fine within Captivate, but do not work well in internet explorer or firefox. I have tried the htm and the swf files. When the user has

  • Searching for equivalent Labview supported (Arm microcontroller based)development board

    hi every one i need to work on some development kit based on 32 bit microcontroller, i already have AVR 32 based EVK 1100 evaluation kit, but i am interested to work with Labview enivroment on ARM microcontrollers, can anyone help me for this, how co