


[Transfer] Configure multiple websites in XAMPP, configure multiple xampp_PHP tutorial
[Transfer] Configure multiple websites in XAMPP, configure multiple xampp
XAMPP virtual host configuration, bind multiple domain names to access local sites
XAMPP Sometimes you need some top-level domain name access methods to access your local project, which is the virtual host configuration. At this time, you need to configure the virtual host and bind a domain name to your directory to achieve multi-domain binding. access.
I have always used MAMP to build a local php environment on Mac because of its powerful combination configuration and convenient UI operation. Because the company's computers are Windows, sometimes you need to set up a PHP environment to debug some small things to facilitate your work. Since it is just a small application, there is no need to build a local WAMP environment by yourself. There are still many WAMP environment integration packages online. I have never used PHPNow, WampServer, PHPStudy, AppServ, EasyPHP, etc., and UniServer, which I have been using before, is so dazzling that I am dazzled. I actually don’t know the reason why I didn’t use UniServer later. UniServer is very powerful and worth recommending, but then I switched to XAMPP because it is also very powerful and the file package is more than 100MB. Of course, you can download the Lite version. , but the file size is several times larger than UniServer. Maybe it was because of its size that I later switched to XAMPP.
Sometimes you need some top-level domain name access methods to access your local project files instead of directory access. In this case, you need to configure a virtual host and bind a domain name to your directory. (If you are local, you can bind any domain name such as www.a.com or localdemo by modifying the hosts file).
Now assume you have two directories, one exists in /xampp/htdocs/a and the other exists in /xampp/htdocs/b.
Now when you want to access www.a.com for local testing, the corresponding directory is /xampp/htdocs/a, and the corresponding directory for accessing www.b.com is /xampp/htdocs/ b.
If you know how to configure Apache, you can actually avoid it, because XAMPP is nothing more than integrating environment integration packages such as APache, and implementing multiple domain names is achieved by configuring Apache.
Of course, there are many methods that can be found online, but the information on the Internet is reprinted and reprinted. I doubt whether some methods have been verified or not and I don’t know whether they are correct. The following method was personally tested by me. If you still cannot achieve local multi-domain debugging according to my configuration, it may be because your XAMPP version is inconsistent with mine. You can tell me in the comments below and I will answer it for you. The following configuration is for XAMPP Windows 1.7.1 version.
1. First modify the hosts file in the WINDOWSsystem32driversetc directory on the C drive, open it with Notepad, and add:
(added at the end of the file)
127.0.0.1 www.a.com
127.0.0.1 www.b.com
2. Open the xamppapacheconfhttpd.conf file, search for "Include conf/extra/httpd-vhosts.conf", and make sure there is no # comment in front, that is, make sure the vhosts virtual host configuration file is introduced .
When httpd-vhosts.conf is enabled, the default httpd.conf default configuration becomes invalid (make sure the virtual host configuration is also enabled in the httpd-vhosts.conf file, see Article 3), Domain names accessing this IP will all point to the first virtual host in vhosts.conf. (Note that it is the first one, see Chapter 4 for details)
3. Set in the virtual host setting file xamppapacheconfextrahttpd-vhosts.conf:
Cancel NameVirtualHost *:80 The ## in front of this will enable vhosts.conf, and the default httpd.conf default configuration will be invalid. Virtual host configuration will only be set in httpd-vhosts.conf.
DocumentRoot /xampp/htdocs/a
ServerName www.a.com
DocumentRoot /xampp/htdocs/b
ServerName www.b.com
4. After setting up item 3, you will find that access localhost points directly to the path set as a. This issue is discussed in Article 2. That is to say, after vhosts is enabled, the default httpd configuration will become invalid, and the default access will point to the first setting in vhosts. At this time, you need to set back the localhost directory configuration.
DocumentRoot /xampp/htdocs/
ServerName localhost
At this point, the XAMPP virtual host is set up. Now access localhost or the original XAMPP help guide. Access www.a.com will point to the bound a directory, accessing www.b.com will point to the bound b directory.
----------------------------------------- ------------------------------------------
Instance reference:
XAMPP adds VirtualHost to support multiple sites
Add the following content in the c:xamppapacheconfextrahttpd-vhosts.conf file:
NameVirtualHost *:80
DocumentRoot "E:/php/wordpress"
ServerName wordpress
(This paragraph must be added, otherwise it will be inaccessible)
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
Directory>
(This paragraph returns the localhost default access setting and must be placed at the end)
DocumentRoot "D :/xampp/htdocs/"
ServerName localhost
In the C:WINDOWSsystem32driversetc directory Add the following content to the hosts file:
127.0.0.1 wordpress
Place the file httpd-vhosts.conf:
#NameVirtualHost *:80
Just remove the #

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Title: The working principle and configuration method of GDM in Linux systems In Linux operating systems, GDM (GNOMEDisplayManager) is a common display manager used to control graphical user interface (GUI) login and user session management. This article will introduce the working principle and configuration method of GDM, as well as provide specific code examples. 1. Working principle of GDM GDM is the display manager in the GNOME desktop environment. It is responsible for starting the X server and providing the login interface. The user enters

Understanding Linux Bashrc: Function, Configuration and Usage In Linux systems, Bashrc (BourneAgainShellruncommands) is a very important configuration file, which contains various commands and settings that are automatically run when the system starts. The Bashrc file is usually located in the user's home directory and is a hidden file. Its function is to customize the Bashshell environment for the user. 1. Bashrc function setting environment

Title: How to configure and install FTPS in Linux system, specific code examples are required. In Linux system, FTPS is a secure file transfer protocol. Compared with FTP, FTPS encrypts the transmitted data through TLS/SSL protocol, which improves Security of data transmission. In this article, we will introduce how to configure and install FTPS in a Linux system and provide specific code examples. Step 1: Install vsftpd Open the terminal and enter the following command to install vsftpd: sudo

When we use win11 system, we sometimes need to check the configuration of our computer, but many users are also asking where to check the configuration of win11 computer? In fact, the method is very simple. Users can directly open the system information under settings, and then view the computer configuration information. Let this site carefully introduce to users how to find win11 computer configuration information. How to find win11 computer configuration information. Method 1: 1. Click Start and open Computer Settings. 3. You can view computer configuration information on this page. 2. In the command prompt window, enter systeminfo and press Enter to view the computer configuration.

In the technical field, XAMPP is a commonly used development environment tool. It integrates software such as Apache, MySQL, PHP and Perl, and can help developers quickly build a local server environment. However, sometimes when using XAMPP, you will encounter PHP execution exception problems, which may cause problems in development work. This article will share some troubleshooting techniques to help readers solve the problem when XAMPP encounters PHP execution exceptions. 1. Check the PHP error log. First, when the P in XAMPP

Types of Linux log files and configuration methods In Linux systems, log files are very important. They record the running status of the system, user operations, and the occurrence of various events. By checking log files, system administrators can discover problems in time and handle them accordingly. This article will introduce the common types of log files in Linux systems and how to configure logging. 1. Types of log files System log: System log is a log file that records the operating status of the system, including system startup, shutdown, service startup and stop, etc.

Title: Computer configuration recommendations for building a high-performance Python programming workstation. With the widespread application of the Python language in data analysis, artificial intelligence and other fields, more and more developers and researchers have an increasing demand for building high-performance Python programming workstations. When choosing a computer configuration, in addition to performance considerations, it should also be optimized according to the characteristics of Python programming to improve programming efficiency and running speed. This article will introduce how to build a high-performance Python programming workstation and provide specific

The game Black Myth Wukong will be launched on all major platforms in the summer of 2024. Players need to meet certain computer configurations when downloading the game to experience it. The following is an introduction to the minimum configuration required for Black Myth Wukong. What computer configuration is required for Black Myth Wukong? Minimum configuration operating system: Windows 7, Windows 8.1, Windows 10 (all 64-bit) Processor: Intel Corei5-4430/AMDFX-6300 Running memory: 8GB RAM Graphics card: NVIDIA GeForce GTX9602GB/AMDRadeon R73702GB Storage space: 100GB required Available space recommended operating system: Windows 7, Win
