How to use Appserv to configure multi-site access

Source: Internet
Author: User
In the previous Appserv tutorial, I introduced the AppServ configuration and installation tutorial. Appserv can be used as the PHP integrated environment installation package to implement multiple functions, configuring Appserv to implement multi-site functions makes it easy for PHP developers to use Appserv in their previous AppServ tutorial. I introduced the Appserv configuration and installation tutorial. Appserv can be used as the PHP integrated environment installation package to implement multiple functions, configuring Appserv to implement the multi-site function allows the PHP development team to debug multiple PHP websites in real time. a visitor asked me how to use Appserv to configure multiple sites, I will answer the question in the form of an Appserv tutorial.

  Step 1: Download and install Appserv

I downloaded the Appserv-Win32-2.5.10 version. after the download, double-click it and follow the prompts to install it.

  Step 2: modify the Windows hosts file

My Appserv installation environment is Windows XP. why do I need to modify the hosts file first? This is because the installation and debugging of Appserv are generally performed on the local machine. when Appserv is used to configure multiple sites, the domain names are directed to 127.0.0.1. you need to map different domain names, otherwise, it cannot be accessed even after the configuration is complete, unless you have a public IP and are mapped through DNS.

Find the WINDOWS \ system32 \ drivers \ etc \ hosts file and open it. find127.0.0.1 localhostAnd add the domain name of the test site to be mapped, such

1
2
3
127.0.0.1 www.leapsoul.cn

127.0.0.1 www.phptest.cn

Save the hosts file

  Step 3 of the Appserv configuration multi-site Tutorial: modify the Apache configuration file and enable the virtual host configuration

Find the Apache2.2 \ conf directory in the Appserv installation directory, open the apache configuration file httpd. conf, and find# Virtual hostsSet

1
# Include conf/extra/httpd-vhosts.conf

.

In the Appserv configuration, Apache configuration exists in a custom mode. the preceding statement indicates that Apache enables the virtual host configuration. At the same time, the Appserv multi-site configuration function is implemented as a virtual host. you can also add

1
# LoadModule vhost_alias_module modules/mod_vhost_alias.so

# Remove (after my tests, it does not matter if the Apache Module is not loaded)

  Step 4: modify Apache virtual host configuration

OpenConf/extra/httpd-vhosts.confConfiguration file, which contains two virtual host configuration records. you only need to make some modifications.

Set ServerAdmin and DocumentRoot to "C:/AppServ/www/wwwleapsoulcn/" and "C:/AppServ/www/wwwphptestcn /), ServerName (site domain name information), ServerAlias (site domain name alias) configuration options set for you to set the information. Appserv configures the following multi-site instances:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

ServerAdmin: Your email address
DocumentRoot "C:/AppServ/www/wwwleapsoulcn /"
ServerName leapsoul.cn
ServerAlias www.leapsoul.cn
ErrorLog "log/dummy-host.x-error.log"
CustomLog "logs/dummy-host.x-access.log" common



ServerAdmin: Your email address
DocumentRoot "C:/AppServ/www/wwwphptestcn /"
ServerName www.phptest.cn
ErrorLog "log/dummy-host2.x-error.log"
CustomLog "logs/dummy-host2.x-access.log" common

  Appserv multi-site configuration prompt:If multiple virtual hosts are configured at the same time, make sure that the ServerAlias option is not missing in the first virtual host record; otherwise, the configuration will not succeed.

Finally save the conf/extra/httpd-vhosts.conf configuration file.

When restarting Apache, note that you can useNet start apache2.2OrNet stop apache2.2Restart Apache.

In this case, you can access multiple sites configured with Appserv using IE as the domain name.

The above method is to use Appserv to configure the multi-site access function in the form of domain names. if you use IP, you can also implement this configuration function. The difference is that you need to use different ports. In addition to the original httpd. conf configurationListen 80After the statement, add the port to listen to, such

1
2
Listen 8080.
Listen 8081.

In the conf/extra/httpd-vhosts.conf configuration file Change And other configurations remain unchanged.

Finally, delete the previously configured configuration in the hosts file and restart the Apache service.

Now, the tutorial on how to use Appserv to configure multi-site access by domain name or IP address is complete.

  Note: PHP website development tutorial -leapsoul.cn All rights reserved. please indicate the original source and this statement in the form of a link during reprinting. thank you.

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.