Single ip Address Configuration for multiple domain names in apache in centos, centosapache

Source: Internet
Author: User

Single ip Address Configuration for multiple domain names in apache in centos, centosapache


Set the documentroot directory to/test.

There are two domain names: www.test.com and blog.test.com.

First open httpd. conf, find # Include conf/extra/httpd-vhosts.conf, remove the # sign, set ServerName 192.168.0.1: 80

Then open your httpd-vhosts.conf, open, write

NameVirtualHost 192.168.0.1: 80 # This first paragraph is very important. You must set the current server ip address <VirtualHost ServerName 192.168.0.1: 80>
ServerAdmin test@test.com
DocumentRoot/test
ServerName 192.168.0.1: 80
</VirtualHost> #
<VirtualHost ServerName 192.168.0.1: 80>
ServerAdmin test@test.com
DocumentRoot/test/test1
ServerName www.test.com
</VirtualHost>
#
<VirtualHost ServerName 192.168.0.1: 80>
ServerAdmin test@test.com
DocumentRoot/test/test2
ServerName blog.test.com
</VirtualHost> restart apache to access different directories with two domain names. We also recommend that you create an index under/test. php: Use the header to jump to www.test.com. You can use test.com to forcibly jump to www.test.com and so on. blog.test.com is not affected.

Related Article

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.