Wamp development environment configuration: Configure Apache virtual host, wampapache_PHP tutorial

WBOY
Release: 2016-07-13 09:52:01
Original
1072 people have browsed it

wamp development environment configuration: configure Apache virtual host, wampapache

Website constructionWhen people test locally, it is often not a website, so how can it be like input How can I access the website locally by typing "domain name" in the address bar just like the domain name? Here we need to configure the Apache virtual host !

1. Find the apacheconfhttpd.conf file and find the code #Include conf/extra/httpd-vhosts.conf in the file and delete the previous #!

2. Find the apacheconfextrahttpd-vhosts.conf file. We will configure the virtual machine in this file! Open the file, and you can delete all the #s in front of the code. They only serve as comments. It would be more annoying to leave them here!

3. Let’s talk about the functions of each code,

NameVirtualHost is to set the port number of the virtual machine. There is no need to change it here unless you change the port number of the originally configured wamp!

ServerAdmin email address

DocumentRoot The home directory of this virtual machine

ServerName The domain name of this virtual machine

ServerAlias ​​Alias ​​of the virtual machine domain name

ErrorLog The storage location of the virtual machine error log

CustomLog The storage location of the virtual machine access log

There is common after CustomLog which represents the common log format, and there is also

referer records visitor source information

agent records the version information of the visitor’s agent software

combined Three types of combination

Pay attention to the configuration of each virtual machine, within each VirtualHost tag

Here is an example

4. After you configure a virtual machine in the httpd-vhosts.conf file, change the directory of your virtual machine in httpd.conf and add as many Directory tags as there are virtual machines.

Here is an example

5. Now when you use the domain name you defined in the virtual machine to access the website, you will find that you still cannot access it. Why? We still have the last step to resolve our domain name into an IP address through the DNS server.

First, open the C:WindowsSystem32driversetchosts file locally. Note that if you are not an administrator, you must open it as an administrator. You will find this code at the bottom

This is the resolved IP address of your original localhost. Now it’s simple. Just follow it and resolve your domain name to 127.0.0.1 below!

Then, you need to refresh the dns resolution cache, start -> run -> cmd

Enter ipconfig/flushdns and click the Enter key. When the following screen appears, it means success!

Now, you can access your website normally by entering your domain name!

wamp basic configurationPlease enter

Configure wamp development environment

This article is original to Wang Yelou’s personal blog. If you want to reprint, please indicate the source: Wang Yelou’s personal blog www.ly89.cn

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1010332.htmlTechArticlewamp development environment configuration configuration Apache virtual host, wampapache When website builders test locally, it is often not a website. Then how can I enter it in the address bar like a domain name...
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template