• What is the best installation practice for multiple instances of WordPress on a local PC for development purposes. I want to try different things on multiple installs to compare and not break any work done on other installs.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Use sub-folders, or internal testing domains. Something like:

    locahost/site1
    localhost/site2

    That’s the easy way. You can play around the your Apache setup to allow your own local domains as well, but that’s a fair bit more work.

    I use LAMP so this may be a little (NOT a lot) different for you.

    Of course I can setup using the procedure below as many websites as my server’s resources can sustain.

    Say I want to develop a website for the soon to be declared world government “murdoch.un”
    The website files are at: “/home/ross/webdev/w666”

    I put my intended domain names into the “hosts” file, like this:

    127.0.0.1 murdoch.un
    127.0.0.1 www.murdoch.un

    For me this file is “/etc/hosts”, details for different operating systems are here:
    https://en.wikipedia.org/wiki/Hosts_%28file%29

    Then in my apache2 configuration file:

    /etc/apache2/sites-enabled/001-local

    (The location of this file will depend upon which system you run, and which apache2 configuration it uses)

    I add a block:

    <VirtualHost *:80>
    DocumentRoot /home/ross/webdev/w666
    ServerName www.murdoch.un
    ServerAlias murdoch.un
    </VirtualHost>

    Then I must restart the apache2 service, a reboot would do, as would:
    sudo /etc/init.d/apache2 graceful
    Again this will vary with your operating system.

    I can now on this machine access this website from a browser as:
    https://murdoch.un

    If I wanted to access this development website from a different computer on the network, then I need to know the IP address of this server, say it is 192.168.3.109 then all I need to do is on the other computer, add this line to its hosts file:

    192.168.3.109 murdoch.un
    192.168.3.109 www.murdoch.un

    This is so long as we share the same LAN, if it were outside then I would have to setup port forwarding at my network gateway, which is surely a subject I won’t be covering here.

    Now after I have developed this website, I can deploy the whole website to a host on the internet, register the domain name and setup the nameservers. OF COURSE for the development computer to see this site on the internet, the relevant lines in the hosts file must be commented out, a preceeding # is sufficient.
    NOTE that when I deploy the website, I do not need to go through the “MOVING WORDPRESS” procedure, as far as the website is concerned it is not moving ! I think this is a great benefit of this technique.

    Even if you are not using an apache2 web server, your configuration will be similar to this.

    @rossmitchell — although the basics are pretty much the same, there’s a lot of details in your post that are really Mac-specific that may be confusing, especially the paths you mention.

    (As a WAMP/Windows user, I know what you’re talking about but it may be confusing for someone starting out). ??

    @lastorga: do you have WAMP running already?

    @mark, actually they are Linux specific, even Ubuntu specific. I thought I signposted where these differences would be, I did say LAMP.
    Since you ARE a WAMP user, and KNOW what the differences are, then just maybe you could contribute to the progress of the exercise by saying just what these differences are on your version of Windows:

    Like this:
    HOSTS file – already handled by wikipedia
    SITES-ENABLED ? so where is it ?????
    Restarting apache ? I said a reboot would do.
    Anything else ?

    Thread Starter LAstorga

    (@lastorga)

    Actually what catacaustic said above is more of the direction I was thinking of. We are just sticking our toe in the water regarding WP and looking at a single PC(WIN7) with multiple instances as a proof of concept. I installed XAMPP and WP and its working. I guest the big question is how to install WP in a separate folder with a different named DB without stepping on the original WP space. I just perused the forum for “instances” and it seems others have like questions. Looks like there should be a formal paper on this for different OSs. Any additional help would be great for this WP newbie.

    @mark, actually they are Linux specific, even Ubuntu specific.

    Shows how much I know of Linux. ??

    @lastorga: if that works for you, great! However, keep in mind that since all those WordPress instances are using the same domain name (probably “https://localhost&#8221; ?), you may run into issues where the root of the site will be referred to, e.g. a link to “/home” or a path to “/wp-content/themes….”.

    Usually this is not a problem since the base URL of your site is set in the site’s settings, but it’s not a good way to reproduce a “real” situation where every site has its own URL/domain.

    Again, if Catacaustic’s way works for you, then that’s good but if you’re interested in having multiple domains (such as https://testsite1, https://testsite2, etc.) then let us know and I’ll try to expand (WAMP-focused) on RossMitchell’s post above.

    Thread Starter LAstorga

    (@lastorga)

    Thanks Mark – Everyone’s suggestions have been great and gave me a peak into the direction I want to try. I am going to take a few days and play around with this and attempt to come up with a solid test and development environment, hope I don’t break anything. I let you all know. Again thanks you everyone for the help.

    I’ll toss my 2 cents in here as well ??

    The easiest way to run multiple sites locally is the method catacaustic mentioned, and it works the same way on Windows and Mac (can’t speak for Linux). This method works for XAMPP (Win and PC), WAMPServer, Uniform Server, MAMP (Win and PC). These are the ones that I use (US is my fave though ??

    In all of the above, you will have your document root or web root. It will be named either htdocs or www. It is within this location where you create a sub folder to place the files for that particular site.

    Note however, that you can also install directly into the root for ONE site ONLY, although it’s not recommended due solely to it ‘cluttering up’ the root. No technical reason why not though.

    Also note that you are not limited to what ‘script’ you add to this; it’s not restricted to WordPress. Any PHP/MySQL script will work as well as plain old static HTML sites; just place all the files for them in separate folders within the root. Joomla!, Drupal, Prestashop, eFront are just some of the ones I have in my various local servers. You can add as many installs as your hard drive has room for.

    So, to add another WP (Joomla!, eFront, Prestashop, etc.) site (“instance”), just create a new database for it, create a new folder in the root, place the files for it within it and run the installer ??

    For XAMPP, extract the WP package in htdocs (the root). The WP package contains a folder named wordpress which contains all the files required. Simply rename this folder to your liking, such as wordpress2.

    Using phpMyAdmin, create a new, empty database and name it wordpress2 for example. Then run the install using:

    https://localhost/wordpress2 and for the database info page, use:

    – Database Name: wordpress2
    – Database User: root (the default XAMPP DATABASE user)
    – Database Password: <empty> (do not enter anything here; this is the default XAMPP DATABASE password for the default user)
    – Host Name: localhost
    – Table Prefix: wp_ (leave as-is)

    To add more WP sites, repeat, changing the folder and db names of course ??

    catacaustic version for me, subfolders in my WAMP www files and seperate databases and wordpress installations for each.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Multiple WordPress instances on development PC’ is closed to new replies.