Give help. Get help.

  • # November 15, 2012 at 3:57 pm

    Hey guys,

    I use Apache 2 for development on my local server. I am trying to set up another local website. Googling it, I found virtual hosts.

    I have altered three files: windows’ hosts file, apache’s httpd.conf and apache’s httpd-vhosts.conf.

    My hosts file, I just added another line: musicnotes
    musicnotes is what I want the new “domain” to be called on my local server.

    httpd.conf I uncommented the line which includes the vhosts file so it gets loaded.

    httpd-vhosts.conf, the file (uncommented lines only) says this:

    NameVirtualHost *:80

    DocumentRoot C:varhtdocs

    ServerName musicnotes
    DocumentRoot C:musicnoteshtdocs

    If I change it to this, it still doesn’t work:

    NameVirtualHost *

    DocumentRoot C:varhtdocs

    ServerName musicnotes
    DocumentRoot C:musicnoteshtdocs

    The above version of the file should work according to many sites I have found while googling, yet it doesn’t.

    Now if I type in musicnotes in my browser, it loads my localhost. All the localhost files work as if nothing has happened. (localhost also loads localhost) I do have C:musicnoteshtdocs set up and an index.php file is sitting in there.

    I have refreshed Apache many times after I change the config files. But it still doesn’t work…


    # November 15, 2012 at 7:52 pm

    I’m not sure if it makes a difference, or if we have different versions of Apache, but I don’t use a httpd-vhosts.conf file at all, and have my virtual hosts all in the httpd.conf file:

    Include “c:/WAMP/alias/*”

    NameVirtualHost *:80

    DocumentRoot “c:/Projects”
    ServerName localhost

    DocumentRoot “c:/Projects/Testsite”
    ServerName testsite

    A few things you might want to check:

    1) the Include "c:/WAMP/alias/*" line, not sure if this required or not

    2) in my case, the other sites have to be in a subfolder of the “main” site, in my case C:/Projects. The main site is what has been set as the “document root”, a little higher in the httpd.conf. I’m sure this should not be a requirement, but I can’t get it to work when a site is outside of that location, so maybe may be for you too.

    Who knows this helps.

    # March 29, 2013 at 7:33 pm

    Hi Senff that what I thought. So if I do just the changes outlined in your linked post connected the httpd.conf file I should then be able to use MAMP with the localhost:8888?

    # March 29, 2013 at 10:48 pm

    Hey guys, not knocking WAMP and don’t want to derail you, but ever since I found I have left the other stack packages like lampp and wamp behind. This is so much easier to use and has a great GUI for setting up vhosts. Check it out. It should be right up your alley since you are using windows right? I am pretty experienced with this package. So if you wanna try it out and have any questions let me know.

    # March 30, 2013 at 5:29 am

    If you using MAMP Pro (Mac) Chris pointed this out to me on one of the other posts

    It’s basically Server > General > Apache [ 80 ] (default ports)

    If you do this, plus follow what he does in his two free videos about the using MAMP Pro you should be okay.

    That the slightly confusing part because if you by MAMP Pro you don’t have to mess with all this VirtualHost 80 stuff below.

    DocumentRoot “c:/Projects/Testsite”
    ServerName testsite


Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.