Use xampp to build and run a php vm. xampp VM _ PHP Tutorial

Source: Internet
Author: User
Use xampp to set up and run a php VM. Detailed steps for using xampp to build and run a php virtual host. recently, xampp is installed as a new software to build its own web development environment, after the installation is complete, you need to virtualize several steps to use xampp to build and run the php virtual host. xampp virtual host

Recently, xampp is installed as a new software to build its own web development environment. after the installation is complete, several virtual directories are required for your project, 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.

Recently, Vivo has installed xampp, a new software, to build its own web development environment. after the installation is complete, several virtual projects are required...

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.