Use xampp to build a php VM _ php instance

Source: Internet
Author: User
This article describes how to use xampp to build and run a php virtual host. For more information, see the recent introduction, after xampp is installed as a new software to build its own web development environment, after installation, several virtual directories are required to put their own projects, the following is a summary of how to create a VM in the xampp web server environment, The general process is divided into three steps., As follows:
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 the D Disk: use NotePad to open D:/xampp/apache/conf/httpd. 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 FollowSymLinksServerAlias 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 empty. If it is changed to another port, you need to write it, and also modify the listening port number in httpd. conf: Listen 80
ServerName:The website domain name, same as above, must be entered;
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. It is not required to not display the directory list;
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:The 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.