Bind a domain name to Apache in centos

Source: Internet
Author: User

This article describes how to bind a domain name to Apache under centos and to multiple domain names to Apache. First, find the location of the Apache configuration file httpd. conf. The centos operating system is generally in/etc/httpd/CONF. Some Linux operating systems are in the/etc/apache2/conf or/usr/local/etc/Apache folder, the remaining thing to do is to modify the configuration file httpd. conf. Generally, the following domain name binding instructions are provided at the bottom of the configuration file:

 
 
  1. # VirtualHost example: 
  2. # Almost any Apache directive may go into a VirtualHost container. 
  3. # The first VirtualHost section is used for requests without a known 
  4. # server name. 
  5. #<VirtualHost *:80>
  6. #    ServerAdmin [email protected] 
  7. #    DocumentRoot /www/docs/dummy-host.example.com 
  8. #    ServerName dummy-host.example.com 
  9. #    ErrorLog logs/dummy-host.example.com-error_log 
  10. #    CustomLog logs/dummy-host.example.com-access_log common 
  11. #</VirtualHost>

You can also add your own configuration instructions based on the relevant syntax. The following is the configuration file of my carefree program: 1. * change the asterisk to the IP address of your website. 2. serveradmin administrator email address (optional) 3. the DocumentRoot website file is located in the directory path of the server. 4. servername is bound to the corresponding domain name. 5. serveralias wildcard DNS is bound to the sub-domain name. 6. errorlog and customlog are used to specify the log file storage path.

 
 
  1. <VirtualHost 175.102.8.117:80>
  2.     addDefaultCharset gbk 
  3.     DocumentRoot /chengxu
  4.     ServerName 66php.com 
  5.     ServerAlias *.66php.com 
  6.     ErrorLog /sym/logs/66php.com-error_log 
  7.     CustomLog /sym/logs/66php.com-access_log common 
  8. </VirtualHost>

If a server is bound with multiple domain names instead of adding multiple domain names to servername, only one domain name can be added to the server name. To bind multiple domain names, you must add multipleVirtualhostModule.

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.