CentOS Configure the virtual host VirtualHost enable the server to support multiple site multiple domain name Method _ server Other

Source: Internet
Author: User
Tags centos centos server

This article describes the CentOS configuration of the virtual host VirtualHost to enable the server to support multiple site multiple domain name method. Share to everyone for your reference, specific as follows:

How to let CentOS (Redhat) Configure the virtual host, let the server support multiple sites, for Apache, only you need to modify the Apache configuration file/etc/httpd/conf/httpd.conf.

There is a example file, you only have to correspond to the configuration.

#<virtualhost *:80>
#  ServerAdmin webmaster@dummy-host.example.com
#  Documentroot/www/docs /dummy-host.example.com
#  ServerName dummy-host.example.com
#  ErrorLog logs/ Dummy-host.example.com-error_log
#  Customlog logs/dummy-host.example.com-access_log Common
#</ Virtualhos>

You can refer to my configuration and add at the bottom of the httpd.conf:

Namevirtualhost *:80
<virtualhost *:80>
ServerAdmin admin@example.com
ServerName www.yourweb.com
#ErrorLog/var/log/httpd/yourweb/error_log
#注意, here I set up the production log
in days ErrorLog "|rotatelogs/var/log/httpd/yourweb/error_log%y_%m_%d.log 86400"
#CustomLog/var/log/httpd/yourweb /access_log Common
Customlog "|rotatelogs/var/log/httpd/yourweb/access_log%y_%m_%d.log 86400" common
</VirtualHost>
<virtualhost *:80>
ServerAdmin admin@example.com
documentroot/var/www/ Html/blog
ServerName blog.yourweb.com
errorlog/var/log/httpd/blog/error_log
customlog/var/log/ Httpd/blog/access_log Common
</VirtualHost>

As above I have configured two virtual host: domain name is www.yourweb.com blog.yourweb.com

Note that the restart of Apache does not take effect (service httpd restart)

I hope this article will help you CentOS server management.

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.