XAMPP Apache multi-port and multi-domain name configuration method

Source: Internet
Author: User
Tags tld

1. Edit D: \ XAMPP \ apache \ conf \ httpd. conf in notepad and add the port to be listened on at the top, for example, 8081. Retain the default listening port 80.

 

Listen 80

Listen 8081.

2. Add:

 

<Virtualhost *: 8081>

Servername localhost // local address. You can try to use 127.0.0.1 or 192.168.1 .**

DocumentRoot D: \ XX // point to your url

<Directory/>

Require all granted

</Directory>

</Virtualhost>

3. Restart Apache (XAMPP ).

 

If you want to add a custom domain name and browse it, follow these steps:

 

1. Configure the domain name (any): www.a.com, point to 127.0.0.1 (Local Machine)

(1) Open c: \ windows \ system32 \ drivers \ etc \ hosts in Notepad

(2) Add the following code at the bottom of the file and save it:

127.0.0.1 www.a.com // in this way, browsing www.a.com will point to the Local Machine

2. Edit D: \ XAMPP \ apache \ conf \ httpd. conf.

 

<Virtualhost *: 8081>

Servername www.a.com

DocumentRoot D: \ XX // point to your url

<Directory/>

Require all granted

</Directory>

</Virtualhost>

/* ===================================================== ========================================================== ======= */

Note:

1. The following is the configuration version of virtualhost. Please refer to and reference it.

<Virtualhost *: 80>

Serveradmin [email protected]

DocumentRoot "/XAMPP/htdocs/www. ABC. TLD"

Servername www. ABC. TLD

Errorlog "logs/www. ABC. tld-error.log"

Customlog "logs/www. ABC. tld-access.log" combined

</Virtualhost>

2. Note the following:

As stated in the preceding section, if an error occurs again, you can open tools such as xampp_start.exe to clear the mine.

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.