ArtsAutosBooksBusinessEducationEntertainmentFamilyFashionFoodGamesGenderHealthHolidaysHomeHubPagesPersonal FinancePetsPoliticsReligionSportsTechnologyTravel

Install WordPress MU On Localhost 127.0.0.1

Updated on December 2, 2012

Yes you can install WordPress 3.X  

In

Multi Blog / Multi  user mode on localhost or 127.0.0.1.

WordPress 3.X Has Built-in Multi Blog Capabilities

I’m not sure whether most non technical people know that from WordPress version 3.X onwards, multi user Blogging capabilities are built directly in the WordPress core itself.  This is really exciting because now anyone can use the world’s best Blogging platform and setup up multiple Blogs for themselves OR multiple Blogs that can be access and used by other users and yet be completely independent from each other. 

What’s exciting about this one may ask? Well for one there is only a single installation of WordPress setup and configured to run in Multi user mode. 

In the past for every additional Blog there had to be:

  1. A completely fresh installation of WordPress
  2. With its associated database and tables
  3. Each such fresh WordPress installation consuming its own amount of hard disk space
  4. Each associated database and set of tables consuming its own amount of hard disk space

With the release of WordPress version 3.X all this has changed.  Since the WordPress core already has multi Blog / Multi User capabilities built in with a little configuration all of the above issues melt away.  Now I know a lot of people would like to try installing WordPress in multi Blog mode on their own desktops or laptops first.  Play around with this installation for some time to get the hang of using WordPress in multi Blog mode. 

While looking around on the Internet, I did not find any tutorials that were clear and lucid, that helped an individual do the following:

  1. Install and configure WordPress 3.X to work as multi Blog / multi user on localhost
  2. Then after installation and configuration go on to demonstrate how to Add a new Blogs as well
  3. All done on your desk top or laptop for try-out / experiment-with purposes on localhost

So I decided that I would write just such a tutorial myself.

NOTE: Most of the tutorials I saw seemed to indicate that it was not possible to install / configure WordPress in Multi Blog mode on a desk top or laptop with Apache web server running identified by localhost or the ip 127.0.0.1

This believe me is definitely not true.

Sure there is a simple reasons why one cannot install and configure WordPress 3.X to run on localhost or on the ip 127.0.0.1 – but all this requires is some simple entries to be made in your HOSTS file as a work around.  The reason being - Domain Name Resolution.

When multiple Blogs are setup, each Blog should be configured to run as a subdomain of the main Blog installation. Now here is where the DNS issue raises its head. 

Normally the Main Blog will have its URL which would be something like www.mainblog.com.  Assuming one requires another Blog, let’s say firstchild to run as a subdomain its URL will be firstchild.www.mainblog.com which will definitely return a 404 - Page not found error from Apache web server.

WordPress cannot handle a URL that is structured as firstchild.www.mainblog.com , what WordPress can handle is a URL that reads firstchild.mainblog.com ( do notice the absence of www ).

Hence when creating the virtual domain under Apache for the parent Blog ensure that the ServerName directive in the httd-vhosts.conf file is set to mainblog.com and not to www.mainblog.com as is often the case.

Additionally, do remember to ensure the ServerAlias directive in the httd-vhosts.conf file carries the value *. mainblog.com .  This informs Apache that there will be multiple aliases used with this specific URL.

Here is what a typical virtual host, set of instructions, to Apache should read like when setting up WordPress to work as a Multi User / Multi Blog in a virtual domain.

#
# Multi User WordPress Experiments
# Instructions for Apache to locate the multi user WordPress virtual domain - Ivan on 17th Mar 2011
#
<VirtualHost *:80>
ServerAdmin ivan@ivanbayross.com
DocumentRoot "e:/public_html/cleanwp3"
ServerName multiuserwp.com
ServerAlias *.multiuserwp.com
ErrorLog "e:/public_html/cleanwp3/errors/errors.log"
#   CustomLog "logs/dummy-host2.localhost-access.log" common
</VirtualHost>

Do pay careful attention to the values assigned to the Apache directives ServerName and ServerAlias .

Domain Name Resolution Issues

The next issue you have to tackle is Domain Name Resolution, which normally requires a Domain Name Server which has the appropriate domain name / ip mapping and offers such resolution to any Browser that requires it.

Well here’s the thing, all Browsers always reference the HOSTS file on the local computer first for domain name resolution before broadcasting the URL on the Internet and waiting for a DNS server to reply with an ip. 

Which is just perfect, because you now have a perfect place to do your own domain name resolution on your local desktop or laptop i.e. it’s HOSTS file.

In Windows the HOSTS file is normally found in
c:\windows\system32\drivers\etc\hosts 
In Linux the HOSTS file is normally found in:
/etc/hosts

Open the hosts file in your favorite ASCII editor and ensure that it contains the following entries.

127.0.0.1              localhost              localhost.localdomain

If your hosts file contains the entry:
127.0.0.1              localhost.localdomain

Simply copy / paste this entry in your hosts file, so that you have duplicate entries.

Then place a # sign in front of the second line, ( i.e. the one you just copy / pasted ) to rem it out.

Next delete the .localdomain section from the current entry that is not remmed out.

Your host file entries should look like this:

#127.0.0.1           localhost.localdomain
127.0.0.1             localhost             
( Notice the .localdomain section is deleted )

NOTE: The separator between the ip and the URL being a TAB.

The next few entries you will have to make are going to the be the URLs of your main Blog and its associated child Blogs so that when you are testing your installation your Browser will get its URL to ip resolved from within your hosts file. 

If not all you will get is a 404 page not found error from Apache when you try to connect to your Main or Child Blogs.

Here is what a typical hosts file entry would look like if you had a main Blog whose URL was multiuserwp.com with two child Blogs one named meher.multiuserwp.com and the other named parab.multiuserwp.com

#127.0.0.1           localhost.localdomain
127.0.0.1             localhost             

127.0.0.1              multiuserwp.com
127.0.0.1              meher.multiuserwp.com 
127.0.0.1              parab.multiuserwp.com              

All you have to do to when you want to add another Blog in your local Apache installation is add yet another line in your hosts file with the appropriate URL.

This approach will really take care of all the DNS resolution that you might need when testing WordPress out in multi Blog / multi user mode on your local computer.

If you would like to read about how you should install and configure WordPress 3.x in Multi Blog / Multi User mode I’m writing a tutorial on that pretty soon.  Do watch this space.

Ivan Bayross
Open source tutorials | Open source training

working

This website uses cookies

As a user in the EEA, your approval is needed on a few things. To provide a better website experience, hubpages.com uses cookies (and other similar technologies) and may collect, process, and share personal data. Please choose which areas of our service you consent to our doing so.

For more information on managing or withdrawing consents and how we handle data, visit our Privacy Policy at: https://corp.maven.io/privacy-policy

Show Details
Necessary
HubPages Device IDThis is used to identify particular browsers or devices when the access the service, and is used for security reasons.
LoginThis is necessary to sign in to the HubPages Service.
Google RecaptchaThis is used to prevent bots and spam. (Privacy Policy)
AkismetThis is used to detect comment spam. (Privacy Policy)
HubPages Google AnalyticsThis is used to provide data on traffic to our website, all personally identifyable data is anonymized. (Privacy Policy)
HubPages Traffic PixelThis is used to collect data on traffic to articles and other pages on our site. Unless you are signed in to a HubPages account, all personally identifiable information is anonymized.
Amazon Web ServicesThis is a cloud services platform that we used to host our service. (Privacy Policy)
CloudflareThis is a cloud CDN service that we use to efficiently deliver files required for our service to operate such as javascript, cascading style sheets, images, and videos. (Privacy Policy)
Google Hosted LibrariesJavascript software libraries such as jQuery are loaded at endpoints on the googleapis.com or gstatic.com domains, for performance and efficiency reasons. (Privacy Policy)
Features
Google Custom SearchThis is feature allows you to search the site. (Privacy Policy)
Google MapsSome articles have Google Maps embedded in them. (Privacy Policy)
Google ChartsThis is used to display charts and graphs on articles and the author center. (Privacy Policy)
Google AdSense Host APIThis service allows you to sign up for or associate a Google AdSense account with HubPages, so that you can earn money from ads on your articles. No data is shared unless you engage with this feature. (Privacy Policy)
Google YouTubeSome articles have YouTube videos embedded in them. (Privacy Policy)
VimeoSome articles have Vimeo videos embedded in them. (Privacy Policy)
PaypalThis is used for a registered author who enrolls in the HubPages Earnings program and requests to be paid via PayPal. No data is shared with Paypal unless you engage with this feature. (Privacy Policy)
Facebook LoginYou can use this to streamline signing up for, or signing in to your Hubpages account. No data is shared with Facebook unless you engage with this feature. (Privacy Policy)
MavenThis supports the Maven widget and search functionality. (Privacy Policy)
Marketing
Google AdSenseThis is an ad network. (Privacy Policy)
Google DoubleClickGoogle provides ad serving technology and runs an ad network. (Privacy Policy)
Index ExchangeThis is an ad network. (Privacy Policy)
SovrnThis is an ad network. (Privacy Policy)
Facebook AdsThis is an ad network. (Privacy Policy)
Amazon Unified Ad MarketplaceThis is an ad network. (Privacy Policy)
AppNexusThis is an ad network. (Privacy Policy)
OpenxThis is an ad network. (Privacy Policy)
Rubicon ProjectThis is an ad network. (Privacy Policy)
TripleLiftThis is an ad network. (Privacy Policy)
Say MediaWe partner with Say Media to deliver ad campaigns on our sites. (Privacy Policy)
Remarketing PixelsWe may use remarketing pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to advertise the HubPages Service to people that have visited our sites.
Conversion Tracking PixelsWe may use conversion tracking pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to identify when an advertisement has successfully resulted in the desired action, such as signing up for the HubPages Service or publishing an article on the HubPages Service.
Statistics
Author Google AnalyticsThis is used to provide traffic data and reports to the authors of articles on the HubPages Service. (Privacy Policy)
ComscoreComScore is a media measurement and analytics company providing marketing data and analytics to enterprises, media and advertising agencies, and publishers. Non-consent will result in ComScore only processing obfuscated personal data. (Privacy Policy)
Amazon Tracking PixelSome articles display amazon products as part of the Amazon Affiliate program, this pixel provides traffic statistics for those products (Privacy Policy)
ClickscoThis is a data management platform studying reader behavior (Privacy Policy)