WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] wordpress 3 network (multisite) on a local development site (53 posts)

  1. keesiemeijer
    moderator
    Posted 4 years ago #

    Hello I'm testing wordpress 3.0 and it looks really good. But I have trouble implementing the new Network (multisite) feature. I used Mamp and Headdress (Mac) to create the local site. This produces url's like these: http://localhost:9016/ When I try to make a "Network" I get the following error: "Error: You cannot install a network of sites with your server address. You cannot use port numbers such as :9016." What local address does work? Or is a network on a local site not possible right now? I would really like this feature for multilingual sites but I need the ability to develop local.

  2. Yeah, the port number is an issue. :) It can't figure out how to form the blog urls off it.

    You can put in a fake domain in your hosts file & use that, or just plain localhost (well, if it was on a standard port...).

    I've got a ton of fake local doamins I use for testing and made up my own extension. ;) testing.loc, localhost.localdomain - anything, really.

    I'm not sure where the hosts file is in Mamp though.

  3. keesiemeijer
    moderator
    Posted 4 years ago #

    I use a host file on my computer to block some sites. Can I use this file to make a fake domain? How would I do that? I don't know much about Mamp. I will do some research. I did a search of the Mamp folder and these are the results:
    host.frm
    host.MYD
    host.MYI
    I don't think these files have anything to do with the problem I have.
    mamp local sites have a default address (without use of Headdress) of: http://localhost:8888/mysite
    Does this mean that the default address wouldn't work also?

  4. I use a host file on my computer to block some sites. Can I use this file to make a fake domain? How would I do that?

    Yeah, that's the file. :) Open it up, add your local IP address (127.0.0.1) and then any fake domain you like.

  5. keesiemeijer
    moderator
    Posted 4 years ago #

    Thank you andrea_r for showing me the right direction to search for. I'm no longer using Headdress for organizing my virtual hosts (multiple local sites) Now I do it by editing the host file of my computer and the httpd.conf file of Mamp. First I had to reinstall Mamp to get rid of all the files Headdress had changed. then I used textwrangler (Mac text editor) to put my wordpress local domains in the host file like so:
    127.0.0.1 localhost mycoolsite.dev anothercoolsite.dev. Text Wrangler will edit the /etc/hosts file with admin privileges. Just use the “Open File by Name” under the File menu.
    After that I put these lines at the bottom of the httpd.conf file (located at Applications/MAMP/conf/apache/httpd.conf)

    NameVirtualHost *
    <VirtualHost *>
    DocumentRoot "/Applications/MAMP/htdocs"
    ServerName localhost
    </VirtualHost> 
    
    <VirtualHost *>
    DocumentRoot "/Users/[Your User Name]/Sites/mycoolsite"
    ServerName mycoolsite.dev
    </VirtualHost>
    <VirtualHost *>
    DocumentRoot "/Users/[Your User Name]/Sites/anothercoolsite"
    ServerName anothercoolsite.dev
    </VirtualHost>

    Substitute "[Your User Name]" with your Username.
    After that you have to reboot or type "lookupd -flushcache" in the Terminal to make these changes take effect.
    Make sure you set Mamps ports to the default Apache and MySQL ports. Click the "Set to default Apache and MySQL ports" in Preferences/Ports.
    Now I have multiple local sites with clean urls (http://mycoolsite.dev/ and http://anothercoolsite.dev/) without a port number and use the Network feature of WordPress.

  6. keesiemeijer
    moderator
    Posted 4 years ago #

    One final update. Permalinks other than the default structure were not working. I found the solution here
    So here is the final code for a virtual host.

    <VirtualHost *>
    DocumentRoot "/Users/[Your User Name]/Sites/mycoolsite"
    ServerName mycoolsite.dev
    Alias /mycoolsite.dev "/Users/[Your User Name]/Sites/mycoolsite"
    <Directory "/Users/[Your User Name]/Sites/mycoolsite">
        Options Indexes FollowSymLinks Includes ExecCGI
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
    </VirtualHost>

    And make sure that the following line is uncommented (ie remove the # before it): LoadModule rewrite_module modules/mod_rewrite.so

  7. Just noting that

    AllowOverride All

    is the relevant bit. This forces your htaccess file into being read and not ignored.

  8. Kate6373
    Member
    Posted 4 years ago #

    I'm having the same problems. Could you tell me what the host file of your computer is? Is it the htaccess file?

    Thanks!

  9. The htaccess file and the hosts file are two different files. ;) Those are their names.

    No idea where it is on a Windows computer.

  10. keesiemeijer
    moderator
    Posted 4 years ago #

    location host file Windows 7/Vista/XP = C:\WINDOWS\SYSTEM32\DRIVERS\ETC
    To access this file in Mac Finder: Go > Go To Folder, and type in /etc. A normal finder window will appear. In this window you find the file called “hosts”

  11. JsonB123
    Member
    Posted 4 years ago #

    Thanks for starting and resolving this thread guys! I also use MAMP and was at a complete loss at how to get it working with WP 3.0 Multi-Site.

    Just to add to the instructions, my ports are Apache 80 and MySQL 3000 (not the defaults) and in order to get it working properly I formatted my httpd.conf section like so:

    <VirtualHost *:80>
    ALL THE OTHER BITS IN HERE (I left out the Alias line as well as all the lines inside the Directory tag except for the AllowOverride All, which is the only relevant line.
    </VirtualHost>

    This is now functioning for me so far...but I need to test further.

    Thanks again :-)

  12. keesiemeijer
    moderator
    Posted 4 years ago #

    Ok I made some changes based on JsonB123 and this is my final code

    Put this above all your virtual hosts

    NameVirtualHost *:80
    <VirtualHost *:80>
    DocumentRoot "/Applications/MAMP/htdocs"
    ServerName localhost
    </VirtualHost>

    And for every site (virtual host) I use this:

    <VirtualHost *:80>
    DocumentRoot "/Users/[Your User Name]/Sites/mycoolsite"
    ServerName mycoolsite.dev
    <Directory "/Users/[Your User Name]/Sites/mycoolsite">
        AllowOverride All
    </Directory>
    </VirtualHost>

    Tested it and it works.

  13. ThaiClimate
    Member
    Posted 4 years ago #

    A slight change in direction. Been using MAMP for several years just fine, but could not get the above to work. Decided to see if I would have better luck with Snow Leopard's own Apache 2 install recognizing it's a bit more cumbersome to get going. Well I've got WP Network Sites functioning, but WP files are not being served to the subdirectory sites. I just get directory listings when at the the sub-site/subdirectory roots. If I append a specific wp-admin file path to the sub-site's url I get a 404 error.

    My .htaccess file is per the code generated by the WP network install script. WP is installed in Snow Leopard's User Sites root folder .../user/Sites/ with the root url being http://10.0.1.5/~user/ I'm not using any virtual hosts at the moment so the urls are straight out of Snow Leopard's box. The urls all seem to be appropriately represented in the config.php, .htaccess and within WP sub-site configurations.

    Is there something specific I might try with the PHP's httpd.conf and httpd-vhost.conf settings? I have tried the following in the vhost.conf:

    <Directory "/Users/username/Sites/">
    Options Indexes MultiViews
    AllowOverride All
    Allow from all
    </Directory>

    But this just gets the the "Forbidden" permissions' error for everything including the main site.

  14. Assign it a fake domain in your hosts file. Won't work on an IP address.

  15. ThaiClimate
    Member
    Posted 4 years ago #

    Do you mean assign the fake to the main site root as in mainsite.dev. When I do that I get the "Forbidden" permissions error?

    vhosts.conf settings:

    <VirtualHost *:80>
      <Directory /Users/username/Sites>
        AllowOverride All
      </Directory>
      DocumentRoot /Users/username/Sites
      ServerName mainsite.dev
    </VirtualHost>

    FYI, I don't get the error if I assign a fake to a WP subsite/subdirectory. In fact it seems every time I try to assign a fake domain to a WP install directory I get the "Forbidden" error.

  16. ThaiClimate
    Member
    Posted 4 years ago #

    Ok everything has been reinstalled under the fake domain mainsite.dev. Thus we have mainsiste.dev/subsite1, mainsite.dev/subsite2, etc. This is how the urls appear, but the subsites have the same problem as before, WP pages are not being served to them. I just get directory listings for subsites.

    Here's the user.conf code

    <Directory "/Users/username/Sites/">
        Options Indexes MultiViews
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>

    Here's the vhosts.conf code

    NameVirtualHost *:80
    
    <VirtualHost *:80>
      <Directory /Users/username/Sites>
        AllowOverride All
        Options +FollowSymLinks
      </Directory>
      DocumentRoot /Users/olmini/Sites
      ServerName mainsite.dev
    </VirtualHost>

    If "Options +FollowSymLinks" is not there, error 403 shows up?

  17. keesiemeijer
    moderator
    Posted 4 years ago #

    I dont think you put something like this in your host file.

    127.0.0.1 localhost
    127.0.0.1 mainsiste.dev/subsite1
    127.0.0.1 mainsiste.dev/subsite2

    Then it will not work.
    To access this host file in Mac Finder: Go > Go To Folder, and type in: "/etc". A normal finder window will appear. In this window you find the file called “hosts”. Open it with a text editor. After you edited and saved this file you have to clear your DNS cache or reboot for the changes to take effect. To clear DNS cache in Leopard or Snow Leopard, just type this in your Terminal (Applications/Utilities/Terminal.app) and hit enter"
    dscacheutil -flushcache
    (it's also better to use Mamp for local development sites in stead of Snow Leopard's own Apache!)

  18. keesiemeijer
    moderator
    Posted 4 years ago #

    and for every virtual host use something like this:

    <VirtualHost *:80>
    DocumentRoot "/Users/username/Sites/mainsiste.dev/subsite1"
    ServerName mainsite.dev/subsite1
    <Directory "/Users/username/Sites/mainsiste.dev/subsite1">
        AllowOverride All
    </Directory>
    </VirtualHost>

    directory path inside quotes and full path to individual sites

  19. ThaiClimate
    Member
    Posted 4 years ago #

    Thanks much for the suggestions so far. The hosts file had been updated, else I would never have gotten mainsite.dev to feed me the WP's mainsite content. But I had not done any mapping of the subsites as suggested. So took care of the subsites in hosts and vhosts.conf. Unfortunately, the situation remains unchanged. WP only serves up mainsite.dev, with just the directory listings for the subsites, which are physically empty.

    One thing I did notice in keesiemijer's settings' suggestions above, is that it has mainsite as a subdirectory in Sites. I've got everything at the Site's root, figuring that might be less prone to error. Will try moving everything one level down and see if that triggers any changes?

    As noted earlier, I went this rout as the MAMP solutions above were not working for me (have used Single User WP on MAMP successfully for years). Figured I would give the native Snow Leopard package a try--again noting that it's a bit harder to get the Apache/Php/Mysql thing set up than with MAMP. But once up, figured I would be no worse off. And indeed, I'm visibly further along, as with MAMP I could not get the mapping to even serve me WP's on main site for installation. Also, if this could work, be another set of options for folks. But close is not close enough, so maybe I will need to go back and try again with my MAMP configurations.

  20. keesiemeijer
    moderator
    Posted 4 years ago #

    One thing I did notice in keesiemijer's settings' suggestions above, is that it has mainsite as a subdirectory in Sites.

    If that is where your wordpress files live. I think you have to link to each individual site (folder) in your Sites Folder. Maybe not to the subsites. Maybe this is enough for your mainsite setup with subsites:

    127.0.0.1 localhost
    127.0.0.1 mainsite.dev
    <VirtualHost *:80>
    DocumentRoot "/Users/username/Sites/mainsite"
    ServerName mainsite.dev
    <Directory "/Users/username/Sites/mainsite">
        AllowOverride All
    </Directory>
    </VirtualHost>
  21. ThaiClimate
    Member
    Posted 4 years ago #

    Thanks again. Back at it with little change.

    First off. Very newbie question for WP multi sites. When a new site is created by Super Admin, does WP automatically create the directory in blogs.dir for that site [#]? If not, is there any other physical representation of the site that can be seen in the file structure/the new site(subsite's) actual folder following the site's creation. I ask because I'm not seeing anything in the blogs.dir folder, but am not getting any kind of error that the directory could not be created? If all content goes into blogs.dir/[#] and themes are all in themes, trust WP proper does nothing with the site's physical path folder?

    Probably more critical the _site_meta table shows nothing for any subsites. Meta data only for site[1]. The _bolg table has all sites though. Guess I should have checked this out earlier, but certainly going to be a problem with no theme info to help serve the page. But surprised I'm not getting any errors? This is a whole other basket of issues I trust.

    Regarding the directive: DocumentRoot "/Users/username/Sites/mainsite", etc.
    I do not have a folder names mainsite. So ../Sites/ itself is the folder for mainsite's content. All files are in the Sites/ root, e.g. .../Sites/wp-config.php, etc.. So unclear on where such a directive would be pointing?

  22. Each blog is virtual - whether it is a subdomain or subfolder blog, nothing is created on the server. the blogs/dir directory only hold media uplads for each site.

    the site_meta table is old terminology from when it was MU. In new terms, that's *network* meta.

    Deeper reading in the archives at wpmututorials.com

  23. ThaiClimate
    Member
    Posted 4 years ago #

    Thanks Andrea,

    Han indeed seen your tutorials site, and lots of others. You must be pretty tired of users like me, especially when typing things like site_meta instead of _sitemeta. Also saw the discourse on terminology changes so should have been more careful there as well. Anyhow, if someone is interested would just like to know the following?

    1) A subdirectory under blogs.dir should be automatically created for each site. (Now when I upload media to the main site via "Add New" in "Posts" it gets stored in the old Uploads/yr/mo folder.

    2) Should not _sitemeta data be populated for the any new site when the site is created? All the site's new tables are created but that table is not populated?

    Thanks

  24. 1) A subdirectory under blogs.dir should be automatically created for each site.

    Not until the user of that site uploads media files. the blogs(sites) are virtual and you will not find site-specific files on the server.

    2) Should not _sitemeta data be populated for the any new site when the site is created? All the site's new tables are created but that table is not populated?

    remember the old terminology? :) sitemeta is for the *network*, not Sites. You're running one network. No additional info is needed if you add another blog (Site).

    blogs in the db = Sites in the admin area
    site in the db = network in the backend.

  25. ThaiClimate
    Member
    Posted 4 years ago #

    Thanks again Andrea,

    See all the subsite meta data populated in the appropriate subsite option's folder now. Should have thought to look there. With that I can now go back to nailing down getting vhosts and .htaccess playing together so I might actually be able to display one of these subsites.

  26. vhosts are only used for the subdomain option, and wildcard subdomains will not work on localhost. ;)

    just to save the head bashing.

  27. rbickett
    Member
    Posted 3 years ago #

    How about a local subdomain setup. Would you just add the line for "ServerAlias *.mycoolsite.dev" as in the example code below?

    <VirtualHost *:80>
    DocumentRoot "/Users/[Your User Name]/Sites/mycoolsite"
    ServerName mycoolsite.dev
    ServerAlias *.mycoolsite.dev
    <Directory "/Users/[Your User Name]/Sites/mycoolsite">
        AllowOverride All
    </Directory>
    </VirtualHost>
  28. You would do that on a web server, but not on your local machine, as stated above, because the *.yourdomain.com will not work locally.

  29. rbickett
    Member
    Posted 3 years ago #

    OK. So, instead I just setup the subdomains in my local "hosts" file.

    127.0.0.1 subdomain1.mycoolsite.dev
    127.0.0.1 subdomain2.mycoolsite.dev
    127.0.0.1 subdomain3.mycoolsite.dev
    Etc.

    Thanks.

  30. PopTopJosh
    Member
    Posted 3 years ago #

    Can anyone point me in the right direction for getting an existing 3.0.1 network site moved locally for development? I'm using XAMPP and spent yesterday exporting the DB from the live site, copying wp_content, importing the DB into xampp and and dropping the WP-3.0.1 files and my wp_content directory into htdocs. I then changed siteurl and home in the db to http://localhost/domain/ in the DB and updated wpconfig with the DB info. When I try to navigate to http://localhost/domain/, I get to the site's 404 page and a message saying http://localhost/domain/domain/ doesn't exist. Any help or a link to tut on this? Thanks much.

    ~Josh

Topic Closed

This topic has been closed to new replies.

About this Topic