Detailed steps for using xampp to build a php VM

Source: Internet
Author: User
This article describes how to use xampp to build and run a php VM. For more information, see

This article describes how to use xampp to build and run a php VM. For more information, see

Recently, xampp is installed as a new software to build its own web development environment. After installation, several virtual directories are required for your project, we will summarize and share the process of creating a virtual host in the web server environment built by xampp. The process is divided into three steps:
Step 1: use NotePad to open the C:/WINDOWS/system32/drivers/etc/hosts file (win7 hosts file location: % systemroot % \ system32 \ drivers \ etc ),
Under 127.0.0.1 localhost, I added 127.0.0.1 localhost.tuolarapp.com, so that every time I input localhost.tuolarapp.com in the browser, it will not resolve to the network DNS, but will directly resolve it to the local. In fact, you cannot access localhost.tuolarapp.com. Of course, you can set it to sohu.com if you want.
Step 2: Because xampp is installed on drive D: Open drive D:/xampp/apache/conf/httpd with notepad. conf file, I found Include "conf/extra/httpd-vhosts.conf", confirm that no #.
Step 3: D:/xampp/apache/conf/extra/httpd-vhosts.conf, add the following code snippet below:

DocumentRoot "D:/tuolarapp" ServerName "localhost.tuolarapp.com"

Or the details are as follows:

DocumentRoot "D:/tuolarapp" ServerName "localhost.tuolarapp.com" Options Indexes logs 1.com *. 2. comErrorLog logs/www.eachbrand.com-error_logCustomLog logs/www.eachbrand.com-access_log commonAllowOverride AllOrder allow, denyAllow from all

Then save and restart apache. Then, when I enter localhost.tuolarapp.com in the browser, it will be automatically resolved to the website in the D:/tuolarapp directory. The input is much more convenient, and the key self-feeling will be better.

The configuration elements are described as follows:
: Localhost is the website domain name, and port 80 can be left blank. If it is changed to another port, you need to write it and modify the listening port number in httpd. conf: Listen 80
ServerName: the website domain name, which is the same as above and must be filled in;
DocumentRoot: The main directory of the website program, which must be filled in;
Options Indexes FollowSymLinks: displays the directory list. If you want to set a security point, you can remove Indexes without displaying the directory list, which is not required;
Alias: can be accessed through multiple domain names;
ErrorLog: location where error log files are stored;
CustomLog: location where access log files are stored;
ResinConfigServer: Listener port of the Resin server. The local port is 127.0.0.1. If multiple servers are used as servers, change them to the corresponding IP address;
The above completes the configuration of the VM. A website corresponds to Mark;
In this way, xampp is applied to multiple websites.
What if I want to run the site on another port?
Simple: In the "httpd. conf" main configuration file, set multiple ports, such as Listen 8081.

How to Use xampp to build a virtual host for running php? I believe that it will not be difficult for you to encounter similar problems in the future. I hope you will like this article.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.