The MU forums have moved to WordPress.org

WMPU Subdomain rewriting with MAMP (29 posts)

  1. Achilleus
    Member
    Posted 12 years ago #

    Here is my virtualhosts section of httpd.conf:

    # NameVirtualHost *
    
    NameVirtualHost *
    
    NameVirtualHost 127.0.0.1:80
    
    <VirtualHost 127.0.0.1:80>
       DocumentRoot /Applications/MAMP/htdocs
       ServerName localhost
    </VirtualHost>
    
    # This makes sure that localhost works.
    
    <VirtualHost 127.0.0.1:80>
        DocumentRoot /Applications/MAMP/htdocs
        ServerAlias *.acegamingsyndicate.test
        ServerName http://www.acegamingsyndicate.test
    </VirtualHost>

    Unfortunately, it only works for acegamingsyndicate.test after I added that domain to my hosts file, but I can't get the wildcard subdomain rewriting to work. Do I need to add the wildcard information in my hosts file also, or just httpd.conf?

  2. Achilleus
    Member
    Posted 12 years ago #

    This is my hosts file, in case I didn't do something right here:

    ##
    # Host Database
    #
    # localhost is used to configure the loopback interface
    # when the system is booting.  Do not change this entry.
    ##
    127.0.0.1	localhost
    255.255.255.255	broadcasthost
    ::1             localhost
    fe80::1%lo0	localhost
    127.0.0.1 acegamingsyndicate.test
  3. lunabyte
    Member
    Posted 12 years ago #

    Google to learn about a hosts file. What it is, and what it does.

  4. Achilleus
    Member
    Posted 12 years ago #

    Now I'm finding that I have to set up the test domain using the Directory Utility. I opened a topic at the apple forum asking how to do this, because I couldn't find any guides on Google for it.

    [edit]
    Hehe you posted as I was writing that. It's not the hosts file that I need to mess with, as it happens. Would you or anybody else happen to know how to use the directory utility on a mac? I've found guides that explain how to do it with the Netinfo utility, but in Leopard it got replaced by the Directory Utility which is completely different.

  5. lunabyte
    Member
    Posted 12 years ago #

    That is not correct.
    You most certainly can, and easily, use the hosts file. I do it every day.

    We're talking 10.5.4, user and server, across Mac Pro's, iMac's, and MacBooks.

  6. Achilleus
    Member
    Posted 12 years ago #

    For wildcard subdomains? I read that you couldn't use wildcards with the hosts file, I suppose I'll keep looking.

  7. lunabyte
    Member
    Posted 12 years ago #

    You can't, but in a testing environment you sure can make a few test subdomains to play with.

  8. jorne
    Member
    Posted 12 years ago #

    I posted in this thread this for about two weeks ago but did not get any reply. http://mu.wordpress.org/forums/topic.php?id=8349

    I have this in my host file:

    ##
    # Host Database
    #
    # localhost is used to configure the loopback interface
    # when the system is booting. Do not change this entry.
    ##
    127.0.0.1 localhost.localdomain
    255.255.255.255 broadcasthost
    ::1 localhost

    and in my httpd.config file:

    NameVirtualHost *

    NameVirtualHost 127.0.0.1

    <VirtualHost 127.0.0.1>
    DocumentRoot /Applications/MAMP/htdocs
    ServerName localhost
    ServerAlias *.localhost.localdomain
    </VirtualHost>

    If someone can help me solve this I will write a short tutorial. It seems many have problems with this.
    I running MAMP now on Tiger OS X, but can use the build in packages as well, if someone provide a solution.

  9. pumpkinpatch
    Member
    Posted 12 years ago #

    127.0.0.1 localhost.localdomain
    127.0.0.1 subdomain1.domain.com
    127.0.0.1 subdomain2.domain.com
    127.0.0.1 subdomain3.domain.com
    ...
    Add each entry manually. No wildcards.

  10. jorne
    Member
    Posted 12 years ago #

    Yes this is working, I do like this until I upload my script to a host. Been wasting way to much time on this already.

    Achilleus did you get your subdomains to work?

    The reason I wanted to get this to work was mainly because I wanted to do some experiment mixing subdomains and subdirectories. In some other threads in this forum people asked this question and got the answer that it is not possible. I do not need my subdirectories to be 100% dynamic
    so I was thinking it might be possible to write something like this somehow?

    127.0.0.1 ServerAlias *.localhost.localdomain
    127.0.0.1 localhost.localdomain/site_1/
    127.0.0.1 localhost.localdomain/site_2/

    or maybe rewrite the path to some blogs in .htacces?

    If you have done something like this or have any ideas please let me know.

  11. Achilleus
    Member
    Posted 11 years ago #

    For OS X you can get a program called DNS Enabler that will configure the built in DNS for you, a guy at the apple.com forums told me about it. I haven't used it yet because I already have the hosts thing set up, but next time I need to do anything with DNS like this I'll be getting that program.

    You can use .htaccess or httpd.conf to configure things like that, you could this in httpd.conf:

    <VirtualHost 127.0.0.1:80>
        DocumentRoot /Applications/MAMP/htdocs/site1
        ServerAlias *.site1.test
        ServerName site1.test
    </VirtualHost>
    
    <VirtualHost 127.0.0.1:80>
        DocumentRoot /Applications/MAMP/htdocs/plone
        ServerAlias *.site2.test
        ServerName site2.test
    </VirtualHost>

    And in your hosts file, you would do this:

    127.0.0.1 site1.test
    127.0.0.1 site2.test

    If you want to use http://www.site.test you would need to add the www. in front of the site1.test in both the hosts file and in front of them in the virtualhosts part of httpd.conf. Personally, I avoided using using localhost because there's no reason to use it if I don't have to. I'd rather use a domain closer to what the real domain is but that's just me.

  12. jorne
    Member
    Posted 11 years ago #

    Thank you for your reply Achilleus.

    I suppose me, you and all other Mac owners have to buy this 15$ program to get WpMu running then?

    Maybe this should be mentioned in the README.txt file?

  13. lunabyte
    Member
    Posted 11 years ago #

    "I suppose me, you and all other Mac owners have to buy this 15$ program to get WpMu running then?"

    That is not right at all.

    You don't have to buy a single thing to run MU on a Mac.
    Zero, zip, zilch. :)

  14. jorne
    Member
    Posted 11 years ago #

    lunabyte!
    You been claiming that, over and over again in different threads in this forum. The only problem is that you do not provide any solutions. So now if we need "Zero, zip, zilch" maybe you could give a solution to all of us who have been struggling with this?

  15. lunabyte
    Member
    Posted 11 years ago #

    What is there to provide?

    OS X comes with Apache, and PHP.
    Add in MySQL, and it's a cake walk.

    MySQL even has packages available that will install it for you, taking away the need to build it from source if you don't want to do that.

    Other than that, what more do you need?
    You set up your virtual host in Apache, just like the documentation says, and that's it.

    If you're making a test environment, and want to fake the domain name for local use, add it to your hosts file.

    Your hosts file won't allow wildcards, but for local testing, what difference does that make?
    It doesn't.

    Example of a hosts entry would be:

    127.0.0.1 domain.loc test.domain.loc test2.domain.loc fred.domain.loc bob.domain.loc

    Nothing difficult, magic or special about it whatsoever.

    I can't say how many times I've already mentioned this. MAMP? Not needed at all.
    You can use it if you want, but there really isn't a need for it.

    The only problem is if the user doesn't know what they're doing with apache, php, and mysql. If they don't, there isn't much help anyone can give them here. But, that isn't platform specific, and they would have issues with it whether they use OS X or Linux.

    OS X already has it all for you, with the exception on not having mysql on the non-server version, but that's nothing that isn't easy to fix.

  16. jorne
    Member
    Posted 11 years ago #

    1. As mentioned earlier in this thread:

    "I running MAMP now on Tiger OS X, but can use the build in packages as well, if someone provide a solution."

    2. In the reply to that message Pumpkinpatch has already given the same solution as you do now.

    "Add each entry manually. No wildcards."

    3. As also stated above, the reason I wanted to get this to work was mainly because I wanted to try to mix subdomains and subdirectories.

    I suppose most members here who are trying to set up subdomains in a development environment do so because they want to do some development? Otherwise they could just stick with subdirectories until they go public?

    So once again:

    I suppose me, you and all other Mac owners have to buy this 15$ program to get WpMu running then?

  17. andrea_r
    Moderator
    Posted 11 years ago #

    "As also stated above, the reason I wanted to get this to work was mainly because I wanted to try to mix subdomains and subdirectories."

    Which, as you also stated you say answers to, does not work.

    "I suppose me, you and all other Mac owners have to buy this 15$ program to get WpMu running then? "

    It was already answered - no you do not.

    And even if you did, I'm sure you'd still be trying to mix subdirs with subdomains and still wonder why it won't work.\

    Because it won't.

    "I suppose most members here who are trying to set up subdomains in a development environment do so because they want to do some development?"

    Exactly. in a test environment you can go in, add a couple subDOMAINS and you have what you need for testing. then it can easily be moved to a live server, you know, that's set up for wildcard subdomains.

  18. lunabyte
    Member
    Posted 11 years ago #

    Wow, I honestly am not sure how to reply to this.

    I can't even really make a recommendation, as I don't feel you're comprehending what needs to be done.

    MAMP on Tiger. OK. So what's the problem here?

    You're wanting to use this for development, right?
    So um, where's the problem again?

    Not wanting to add a few test subdomains into your hosts file? If you're that lazy then have at it with paying for something. It makes no sense to me at all, but to each their own.

    I mean if it's not within your skills to handle all the web server and associated software, then that would be something that would affect any OS you had.

    OR...

    You want to set this up for public use. If so, then the hosts file and such has no bearing on it whatsoever.

    You point the DNS to the IP of the server, add a wildcard A record, and that's it.

    Either way, you're either not understanding the situation correctly, or way over-thinking it.

    It really isn't complex at all.

  19. jorne
    Member
    Posted 11 years ago #

    andrea_r:
    With the solution you provide it is no problem to mix subdomains and subdirectories.

    If it is possible or not using (dynamic) subdomains, and how to get around the limitations I have with WpMU in my project. I have to get the (dynamic) subdomains working.

    lunabyte:
    No I do not comprehending what needs to be done.

  20. jorne
    Member
    Posted 11 years ago #

    In case some other Mac owners do not "comprehend" this.

    No solution for WpMu have been provided to run (dynamic) sub-domains on localhost on Mac.

    If you do not have a internet connection you can try to buy
    DNS Enabler mentioned by Achilleus above. I have not purchased this program and do not know if it works.

    If you have a internet connection you can also get a free domain name at https://www.dyndns.com/ and set up a live server.

    This seems to be the options available for the moment.

  21. MrBrian
    Member
    Posted 11 years ago #

    What lunabyte has been saying is you can run the same software that runs on windows (apache, mysql) will run on mac. The same exact instructions for installing WPMU on windows and linux work for mac also, it's not OS specific but software specific (apache, mysql, php). Maybe this will help you setup apache on your mac.
    http://www.devarticles.com/c/a/Apache/Using-Apache-and-PHP-on-Mac-OS-X/

  22. jorne
    Member
    Posted 11 years ago #

    Well.. I do not use windows so I do not know if the same thing apply to them.

    The link you provide is not relevant to this problem. I already have (dynamic) sub domain working but need access to internet to use them.

  23. MrBrian
    Member
    Posted 11 years ago #

  24. jorne
    Member
    Posted 11 years ago #

    This link is also not relevant to this problem.

    This have to do with running static vs dynamic created subdomains.

  25. MrBrian
    Member
    Posted 11 years ago #

    You better explain your new problem then, because before you said:
    "I have to get the (dynamic) subdomains working. "

    then you said:
    "I already have (dynamic) sub domain working"

    I have already posted everything you need to get subdomains working, on a mac, locally. It's clear you are not comprehending, and it's not helping that you provide no clear info to your problem.

  26. jorne
    Member
    Posted 11 years ago #

    1. I have to get the (dynamic) subdomains working.
    Posted 1 week ago

    2. I do some more research.

    3. I provide the answer for others how do not comprehend.
    (You need to have a internet connection or a special program)
    Posted 1 day ago

    4. I already have (dynamic) subdomain working.
    (If I have access to internet)
    Posted 1 day ago

    If I'm wrong about this you better just post the fix instead of irrelevant links and information.

  27. MrBrian
    Member
    Posted 11 years ago #

    It sounds like you are not qualified to install anything or even take advice. Good luck.

  28. jorne
    Member
    Posted 11 years ago #

    You said:

    I have already posted everything you need to get subdomains working, on a mac, locally. It's clear you are not comprehending.

    MrBrian: You have not post any solutions on this other then the one pumpkinpatch already provided in this thread. "Add each entry manually"

    You said:
    It's not helping that you provide no clear info to your problem.

    MrBrian: I did not post a problem. I posted a solution so other users of the forum do not have to waste time to search for any solution which do not exist. Read Achilleus posts and problem above, that is what we discuss in this tread.

    This forum obviously got the reputation it deserves.

  29. mediafetish
    Member
    Posted 11 years ago #

    This is an old post - I found it while trying to figure out the dns issue for a local install of MU. I don't have anything to add to this topic other than...

    Have a little respect and gratitude for cryin' out loud. These people are hired to wipe our butts and teach us how to do things... they choose to wipe our butts and teach us how to do things. Actually, because of these people and others like them, I now have a career. And it really ticks me off to see them treated as if THEY owe YOU.

    There, I said my piece to an old thread nobody will read anyway... but come on now.

About this Topic

  • Started 12 years ago by Achilleus
  • Latest reply from mediafetish