Domain name-based virtual host configuration for apache on the local machine _ PHP Tutorial

Source: Internet
Author: User
Detailed description of the local machine apache configuration based on the domain name of the virtual host. 1. open the httpd. conf file of apache and find the # Virtualhosts # Includeconfextrahttpd-vhosts.conf section to remove the # Before the Includeconfextrahttpd-vhosts.conf. 2. modify ( 1. open the httpd. conf file of apache and find
# Virtual hosts
# Include conf/extra/httpd-vhosts.conf
This section removes "#" before Include conf/extra/httpd-vhosts.conf.

2. modify the hosts file in the (win7) c:/windows/system32/drivers/etc/directory.
Add 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
The default NameVirtualHost is as follows:
NameVirtualHost *: 80

Added:

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


Modify and restart the server.
Enter the http://x.acme.com in your browser to go to your Directory.

Of course, if you want to add a virtual host to an existing web server, if you want to use the localhost service, you need to add something to the above:
Add 127.0.0.1 localhost to the hosts file.
And add in the httpd-vhosts.conf file:

ServerAdmin localhost@xxx.com
DocumentRoot "/var/www /"
ServerName localhost
ErrorLog "log/localhost-error.log"
CustomLog "logs/localhost-access.log" common

The # Virtual hosts # Include conf/extra/httpd-vhosts.conf section removes "#" before Include conf/extra/httpd-vhosts.conf. 2. modify the location in (...

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.