- How To Host Your Website Using Xampp
- Host Website On Lan Using Xampp
- Host Website Using Wamp
- Virtual Host Xampp
It’s much more difficult to set up a working server system by hand than it is to start programming HTML5 and CSS3 with it. Web hosting solutions can often be intimidating. Setting up your own system by hand isn’t recommended. It’s simply not worth the frustration because very good options are available. How to Open Website in localhost in xampp server. How to Open Website in localhost in xampp server.
So you want to install a WordPress Multi-site Network on your local computer using XAMPP, huh? (you like that HTML Goodies throwback?)
Well, in this article, and the accompanying video I will go through the process to make that happen. I will be using XAMPP to run a “web server” on my local machine allowing me to host web sites. PHP and MySQL are included making it work easily for WordPress and WordPress Multi-site. While I am using XAMPP in this example, I might suggest USBWebServer to run a local site web server as the process is much simpler and quicker. Beyond that though I am not sure of the advantages or disadvantages of either.
If you want to install WordPress multi-site on a live server then check this tutorial.
WordPress Multi-site Setup on XAMPP
WP Multi-site Setup Video Tutorial
First, Download and Install XAMPP and Start the Services
- Do a Google search for “XAMPP” or head right to https://www.apachefriends.org/xampp.html
- In the video I demonstrated using XAMPP for Windows because I have a Windows machine. Those files are found here.
- I downloaded the “Installer” package which is an executable that you can just double-click immediately after downloading.
- During setup I allowed all the defaults. I gave the software permission to go through the firewall, and let everything install to the default folder on my machine.
- After installation you will be asked to launch the Control Panel. Go ahead and launch it. Don’t expect anything exciting, it just creates an icon in the system tray.
- Right-click the tray icon for the XAMPP Control Panel and start Apache and MySQL.
- Next, visit http://localhost/phpmyadmin
- Click on the Databases tab across the top.
- Below the Create database box type in a name for your WordPress database (and make note of it) and click the Create button.
- You can add a new user for the database, or just use “root.”
- Visit http://localhost/security/xamppsecurity.php to set a password for the “root” user.
- Right-click the tray icon for the XAMPP Control Panel and stop, and then start, MySQL after changing the “root” password.
Now, Let’s Install the Latest Version of WordPress
In this next part, we go through a typical installation of WordPress with one small change.
1) First, grab the latest installation package from WordPress.org.
2) Extract the files to your computer.
3) Rename wp-config-sample.php to wp-config.php.
4) Modify the wp-config.php file in a text editor and enter in the database name, and database user name and password. Unless you created a new user, the user will be “root” and the password will be whatever you changed the “root” user’s password to be in the steps above. See below for where to add the database info:
5) Now, in the wp-config.php file just below the line that says “define(‘WP_DEBUG’, false);” and above the line that says “That’s all, stop editing” place the following line to activate WordPress Network capabilities.
6) Visit the folder where you installed XAMPP to. If you left everything at the defaults, look for c:xampp. In there will be a folder called “htdocs.” Empty that folder and move the WordPress files into it.
7) Finish the WordPress installation process by going to http://localhost in your web browser.
How To Host Your Website Using Xampp
Now, Setup the WordPress Network
After following the above steps we are at the point where we got WordPress working on a local machine using XAMPP. And we have “turned on” the ability to have a WordPress Multisite by modifying the WordPress config file. Now, let’s setup the Network by adding some more lines to the wp-config.php and .htaccess files.
1) Login to your WordPress dashboard, which you will be prompted to do after installation.
2) Click Tools >> Network Setup.
3) Give the Network a title, and verify the Network admin email address.
4) Click the Install button.
5) Now you will be presented with two blocks of code. The code in the top box is to be placed into the WordPress config file (the same one where we turned on the ability to have a WordPress Network). Copy the lines and paste them over the “define(‘WP_ALLOW_MULTISITE’, true);” line in wp-config.php. In other words, overwrite that line as it’s no longer needed.
6) Copy the lines from the second box and paste them in the .htaccess file found in the “htdocs” folder. Overwrite all other lines in there that were created by WordPress.
7) Log out, then log back into your WordPress dashboard.
Now, WordPress Multi-site (or Network) is setup on your localhost. In the Network Dashboard you can “network activate” themes and plugins making them available to other “sites” on the network. You can also create/edit sites from within the dashboard.
Host Website On Lan Using Xampp
If you are a WordPress plugin or WordPress theme developer, or provide professional WordPress support from time to time you need to run multiple WordPress websites on the same XAMPP installation on Windows. Multiple websites running on the same Apache web server are called Virtual Hosts. In this easy to follow tutorial we explain how to setup multiple virtual hosts on XAMPP so you can run multiple WordPress websites on the same XAMPP installation.
Configure Virtual Hosts in XAMPP
- To add virtual hosts in XAMPP, or in other words, to configure multiple websites on XAMPP, open the Virtual Hosts Apache configuration file httpd-vhosts.conf from C:xamppapacheconfextra
- Uncomment the below line to enable name based virtual hosts on your XAMPP.
- At the end of the file add the following 4 lines. These 4 lines are used to allow access to the XAMPP configuration pages (to access phpMyAdmin etc) by using the URL http://localhost
- For each other virtual host (website) you would like to configure on the XAMPP Apache web server, add the below code (using www.wpwhitesecurity.com as example).
- By adding the above directives to httpd-vhosts.conf (XAMPP virtual hosts configuration file), the Apache web server running on XAMPP knows that:
- The website files can be found in c:xampphtdocswppro (line 2)
- This website should respond to www.wpwhitesecurity.com (line 3)
- Allow everyone to access the content of the directory (line 4 to 7)
- To test and confirm that all the syntax in the Apache configuration is correct, run the httpd.exe process with the –t switch from the c:xamppapachebin directory as seen in the below screenshot.
Configure the Windows Hosts File
Use the Windows Hosts file to redirect the traffic from your computer to the local installation of XAMPP rather than to the original website. E.g. while testing new WordPress changes for our website WP White Security.com, I add an entry in the Windows Hosts file to redirect requests from my browser to the local intallation of XAMPP. To learn on how to redirect traffic using Windows Hosts file, read our webmaster tip Configuring Windows Host Files.
Configuration example: Running multiple websites on XAMPP
If you would like to add more than one virtual host (website) to XAMPP, simple add more VirtualHost directives to the same file. In my testing environment I have the following websites set up:
Host Website Using Wamp
- www.WP White Security.com from c:xampphtdocswppro
- www.wphandymen.com from c:xampphtdocswphandy
Virtual Host Xampp
To have both websites and the XAMPP configuration pages (localhost) running on my XAMPP installation, I have the following in the XAMPP virtual hosts configuration file (httpd-vhosts.conf).