SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Nov 2012
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Installing multiple Wordpress Sites in Xampp

    Hello!

    I am in the process of installing WordPress locally with Xampp and I will be creating several WordPress sites for clients. After these sites are completed I will upload them to a live server. Is there a way for me to have more than one WordPress installation in Xampp so I can keep these sites separate?

    Thanks!

  2. #2
    SitePoint Wizard
    Join Date
    Oct 2005
    Posts
    1,832
    Mentioned
    5 Post(s)
    Tagged
    1 Thread(s)
    Create the new sites as virtual sites. Each new site resides in its own folder inside the /htdocs folder. You can host as many distinct websites as you want. To do this:

    1) In your /xampp/apache/conf/httpd.conf file, uncomment the line (by removing the pound sign #) that says this:

    Include conf/extra/httpd-vhosts.conf

    That will include your vhosts file where we will set up the different sites when Apache starts.

    2) In your /xampp/apache/conf/extra/httpd-vhosts.conf file (we just moved to another folder, the extra folder), create a setup similar to this:

    Code:
    NameVirtualHost *:80
    
    <VirtualHost *:80>
    DocumentRoot "C:/xampp/htdocs/xampp"
    ServerName xampp
    #ServerAlias
    </VirtualHost>
    
    
    <VirtualHost *:80>
    DocumentRoot "C:/xampp/htdocs/site1"
    ServerName site1.com
    ServerAlias www.site1.com
    </VirtualHost>
    
    <VirtualHost *:80>
    DocumentRoot "C:/xampp/htdocs/site2"
    ServerName site2.com
    ServerAlias www.site2.com
    </VirtualHost>
    And more possible sites if you desire. I'm not sure on the exact syntax, but that syntax above works fine for me. Any time you make configuration changes, you must restart Apache.

    Where site1.com and site2.com are the domain names of the sites you are working on. Then in the /htdocs folder, you place the files for each respective site, site1, site2, etc., in the proper folder as specified in the DocumentRoot directive for each VirtualHost.

    3) Then modify your hosts file so it will resolve requests to site1.com or the www version to the local server running on your machine instead of on the internet. This can be helpful for development as the URL received by Wordpress will contain the domain name and the correct URL as Wordpress expects. On Windows 7, the hosts file is located in C:\Windows\System32\drivers\etc. It may vary depending on your OS. Run Notepad as Administrator so you can edit the hosts file. Place a line similar to this in it for each virtual site you create and save the file:

    Code:
    127.0.0.1 site1.com www.site1.com
    127.0.0.1 site2.com www.site2.com
    All requests to site1.com will be directed to your localhost computer and if you have Apache running, Apache will serve the proper files based on what you put in vhosts. Modifying the hosts file, you will not be able to access the domain on the internet as all requests will be directed to your local server. When you want to access the domain name on the internet again, comment out the line in the hosts file like this:

    Code:
    #127.0.0.1 site1.com www.site1.com
    All requests to site1.com will now be resolved using your ISP's DNS to the sites on the internet. When you want to access the version on your local server, remove the pound sign and save the hosts file.

    It may be a good idea to create a backup copy of your hosts file before modifying it.

  3. #3
    SitePoint Member
    Join Date
    Nov 2012
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Cheesedude!

    That was awesome! Thank you so much!

    Regards,
    misstheresa2009


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •