Home>

The realization of configuring multiple domain names under wampserver is mainly through modifying the Apache configuration file httpd.conf, modifying the httpd-vhosts.com file, and modifying the hosts file.For details, please see below.

When I was learning cross-domain,I wrote an article calledUse multi-port access under wampserverArticle, the default localhost uses port 80. The core that can be accessed using multiple ports is to create a new port.That is to create a new http service, so we can create a new service file pointing to port 8080 under the apache configuration file.Then create a new folder (to store the code), start the service,It's ok.

Today I am going to talk about how to implement the configuration of multiple domain names.Generally, after the installation of wampserver, there will be a www folder. The newly created files can be accessed using localhost + relative address, but for example, I created a new folder called google under www.We can use localhost/google/to access this folder or the files in the folder,But how do I do it if I want to visit it?

In fact, this is much simpler than the previous multi-port access.

1.Modify the Apache configuration file httpd.conf

First we open the apache configuration file httpd.conf. For example, mine is in the f:\ wamp \ bin \ apache \ apache2.2.17 \ conf folder.Find this line:

#include conf/extra/httpd-vhosts.conf

Remove the comment (delete the leading pound sign).

2.Modify the httpd-vhosts.conf file

Open the httpd-vhosts.conf file in the f:\ wamp \ bin \ apache \ apache2.2.17 \ conf \ extra folder, and add this section,such as:

<virtualhost *:80>

documentroot "f:\ wamp \ www \ google"

servername

serveralias google.com

</virtualhost>

3.Modify the hosts file

Open c:\ windows \ system32 \ drivers \ etc \ hosts and add a sentence:

127.0.0.1

4.New Google folder

Create a new folder called google under the www folder.Add an arbitrary file in it,For example index&s=al, then you can access it with.

5.Modify the httpd-vhosts.conf file again

At this time, if you go to localhost and find that you cannot access it again,You need to modify the httpd-vhosts.conf file again and add:

<virtualhost *:80>

documentroot "f:\ wamp \ www"

servername localhost

</virtualhost>

Visit localhost/index.html, and it's ok!

other

When looking for relevant information,I found that basically this step is added,That is, in the httpd.conf file, find this paragraph:

<directory />

options followsymlinks

allowoverride none

order deny, allow

deny from all

</directory>

Modify it to:

<directory />

options followsymlinks includes

allowoverride none

order deny, allow

allow from all

</directory>

But I did not modify it and it will work.If the expected results are not achieved after the above steps,Maybe try adding this step.

The above content is how to configure multiple domain names under wampserver.Hope everyone likes it.

  • Previous jQuery implements a sliding window effect that mimics the homepage's induction mouse changes
  • Next Summary of regular expressions in swift