Home  >  Article  >  Backend Development  >  Detailed steps to use xampp to build and run php virtual host, xampp virtual host_PHP tutorial

Detailed steps to use xampp to build and run php virtual host, xampp virtual host_PHP tutorial

WBOY
WBOYOriginal
2016-07-12 09:07:04876browse

Detailed steps to build and run php virtual host using Now I will share the process of how to create a new virtual host in the web server environment built by xampp.

The rough process is divided into three steps, as follows:

Step one: Open the C:/WINDOWS/system32/drivers/etc/hosts file with Notepad (win7 hosts file location: %systemroot%system32driversetc),
Under 127.0.0.1 localhost, I added a 127.0.0.1 localhost.tuolarapp.com, so that every time I enter localhost.tuolarapp.com in the browser, it will no longer resolve to the network DNS, but directly resolve to the local. So in fact you can’t access localhost.tuolarapp.com. Of course, you can also set it to sohu.com if you like. Second step:
Because my xampp is installed on the D drive: Use Notepad to open the D:/xampp/apache/conf/httpd.conf file, and I found Include "conf/extra/httpd-vhosts. conf", make sure there is no #.
in front of it Step 3: D:/xampp/apache/conf/extra/httpd-vhosts.conf, add the following code segment at the end:

Or the details are as follows:

<VirtualHost 127.0.0.1:80>
DocumentRoot "D:/tuolarapp"
ServerName "localhost.tuolarapp.com"
</VirtualHost>


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

<VirtualHost 127.0.0.1:80>
DocumentRoot "D:/tuolarapp"
ServerName "localhost.tuolarapp.com"
<Directory "D:/tuolarapp">
Options Indexes FollowSymLinks
ServerAlias 1.com *.2.com
ErrorLog logs/www.eachbrand.com-error_log
CustomLog logs/www.eachbrand.com-access_log common
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

Explain each of the above configuration elements as follows:

509e4e6b99ec189e8ee20bf95498ac5c:
localhost is the website domain name. Port 80 does not need to be written. If it is changed to another port, it needs to be written. At the same time, httpd.conf must be modified. Listening port number: Listen 80 ServerName:
Website domain name, same as above, must be filled in; DocumentRoot:
Home directory of website program, must be filled in; Options Indexes FollowSymLinks:
Display the directory list. If you want to set a safe point, you can remove Indexes and not display the directory list. It is not necessary; Alias:
can be accessed through multiple domain names; ErrorLog:
Error log file storage location; CustomLog:
Access log file storage location; ResinConfigServer:
The Resin server listening port, my local one is: 127.0.0.1, if there are multiple machines as servers, just change it to the corresponding IP address; The above completes the configuration of the virtual host. A website corresponds to a 03e60988b94cf6a763ac2ba47fe05450ee672f0beb03b42be69279368a66a410 tag; This completes the application of xampp to implement multiple websites.
What if you want to run the site under other ports?

It's very simple: in the "httpd.conf" main configuration file, set multiple ports, such as Listen 8081 How to use xampp to build a virtual host running php. I believe it will not be difficult for you if you encounter similar problems in the future. I hope you will like this article.

http://www.bkjia.com/PHPjc/1063225.html

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1063225.htmlTechArticleDetailed steps to use xampp to build and run php virtual host. xampp virtual host Recently, I installed a new software like xampp to build myself After installing the web development environment, you will naturally need to virtualize several projects...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn