Native Apache configuration domain-based virtual host detailed _php tips

Source: Internet
Author: User
1. Open the Apache httpd.conf file and find
# Virtual Hosts
#Include conf/extra/httpd-vhosts.conf
This section removes the "#" in front of the include conf/extra/httpd-vhosts.conf.

2. Modify the Hosts file located in the (Win7) c:/windows/system32/drivers/etc/directory
Add a paragraph: 127.0.0.1 x.acme.com (the domain name you use to access)

3. I use the Wamp package, so go to the C:/wamp/bin/apache/apache2.2.11/conf/extra directory
Modify File httpd-vhosts.conf
Namevirtualhost defaults to the following:
Namevirtualhost *:80

Increase:
<virtualhost *:80>
ServerAdmin x@acme.com
DocumentRoot "/var/www/html"
ServerName x.acme.com
ErrorLog "Logs/x.acme.com-error.log"
Customlog "Logs/x.acme.com-access.log" common
</VirtualHost>

Fix it and reboot the server.
Enter the http://x.acme.com in the browser to your directory.

Of course if you want to add the virtual host to the existing Web server, then the original localhost service to be able to use, you need to add something on the basis of:
In the Hosts file, add: 127.0.0.1 localhost
and add in the httpd-vhosts.conf file:
<virtualhost *:80>
ServerAdmin localhost@xxx.com
DocumentRoot "/var/www/"
ServerName localhost
ErrorLog "Logs/localhost-error.log"
Customlog "Logs/localhost-access.log" common
</VirtualHost>

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.