WIN10 about Apache Configuring the virtual Host

Source: Internet
Author: User

Apache installation of the default is not to open the virtual server, if you want to configure the virtual server on the local Apache, similar to the online purchase of virtual host, you can follow the following steps to configure:

1, modify the Hosts file of this machine, as follows

Example:
127.0.0.1 localhost
127.0.0.1 xlb.com

127.0.0.1 xlb2.com

2, open the Apache installation directory, find the httpd.conf file, respectively, remove the following two lines of text in front of the # number.
LoadModule Vhost_alias_module modules/mod_vhost_alias.so
Remove # means enable Apache's virtual host feature.
Include conf/extra/httpd-vhosts.conf
Getting rid of this line means importing the virtual host configuration from the conf/extra/httpd-vhosts.conf file.

3. Open the httpd-vhosts.conf file in the extra directory and set the default configuration

<virtualhost *:80>
ServerAdmin [email protected]
DocumentRoot "/www/docs/dummy-host.localhost"
ServerName Dummy-host.localhost
Serveralias http://www.dummy-host.localhost/
Errorlog "Logs/dummy-host.localhost-error_log"
Customlog "Logs/dummy-host.localhost-access_log Common"
</VirtualHost>

<virtualhost *:80>
ServerAdmin [email protected]
DocumentRoot "/www/docs/dummy-host2.localhost"
ServerName Dummy-host2.localhost
Errorlog "Logs/dummy-host2.localhost-error_log"
Customlog "Logs/dummy-host2.localhost-access_log Common"
</VirtualHost>

Change to the directory and domain name you want

<virtualhost *:80>
ServerAdmin [email protected]
DocumentRoot "d:/wamp/www/"
ServerName localhost
Serveralias localhost
Errorlog "Logs/localhost-error_log"
</VirtualHost>
<virtualhost *:80>
ServerAdmin [email protected]
DocumentRoot "d:/wamp/www/web/"
ServerName test.com (main domain)
Serveralias *.test.com (the server alias here can support Pan-resolution, that is, all subdomains can be resolved to bind to the virtual host)
Errorlog "Logs/localhost-error_log"
</VirtualHost>

If the 403 error occurs after the completion of the httpd.conf found in the:
<directory/>
Options followsymlinks execcgi Indexes
AllowOverride None
Order Deny,allow
Deny from all
Satisfy All
</Directory>

Change to
<directory/>
Options followsymlinks execcgi Indexes
AllowOverride None
# Order Deny,allow
# Deny from all
# Satisfy All
</Directory>

WIN10 about Apache Configuring the virtual Host

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.