Use XAMPP to build a detailed step _php instance of running a PHP virtual host

Source: Internet
Author: User
Recently, the new xampp such a software to build their own web development environment, installation is natural to virtual several directories to put their own projects, now how to build a Web server in the XAMPP environment, the process of creating a virtual host to share a summary, The general process is divided into three stepsAs follows:
The first step:Open c:/windows/system32/drivers/etc/hosts file with Notepad (Win7 Hosts file location:%systemroot%\system32\drivers\etc),
Under 127.0.0.1 localhost I added a 127.0.0.1 Localhost.tuolarapp.com, so that each time in the browser to enter the localhost.tuolarapp.com, it is no longer to the network DNS parsing, but directly resolved to local. So in fact localhost.tuolarapp.com you can not visit, of course, you may also set yourself up as sohu.com if you like.
Step Two:Because I xampp is on the D-disk: Open the d:/xampp/apache/conf/httpd.conf file with Notepad, I find the include "conf/extra/httpd-vhosts.conf", confirm that there is no add #.
Step Three:D:/xampp/apache/conf/extra/httpd-vhosts.conf, add the following code snippet to the back:

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

Or the detailed points 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 so that when I enter localhost.tuolarapp.com in the browser, it will automatically parse the site into the D:/tuolarapp directory. This input is more convenient, the key self-feeling will be better.

for each of the above configuration elements do the following description:
: localhost for the site domain name, 80 port can not write, if you change to another port to write on, but also to modify the httpd.conf in the listening port number: Listen 80
ServerName:Website domain name, ibid., must fill in;
DocumentRoot:Website program main directory, must fill in;
Options Indexes followsymlinks:Display directory list, if you want to set the security point can be indexes removed, do not display directory list, not necessary;
Alias:can be accessed through multiple domain names;
errorlog:Where the error log file is stored;
Customlog:Access log file storage location;
Resinconfigserver:Resin Server listening port, I here is the Local: 127.0.0.1, if there are more than one machine as a server, modified to the corresponding IP address can be;
The above will be the virtual host configuration completed, a Web site corresponding to a Tag
This completes the XAMPP implementation of the multi-site application.
What if you want to run the site under a different port?
Very simple: In the "httpd.conf" main configuration file, set up multiple ports, such as listen 8081

How to use XAMPP to build a virtual host running PHP, I believe that later encountered similar problems, it will not be difficult to everyone, I hope you will like this article.

  • Related 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.