Apache sets the subdomain to use a different IP address.

Source: Internet
Author: User
Tags subdomain
How to further set up subdomains in Apache httpd.conf, and subdomains use separate IP addresses. For example mydomian.com use IP for 1.2.3.4;www.sub.mydomian.com with IP as 2.3.4.5?


#省略LoadModuleListen 80User apachegroup apacheserveradmin root@localhostservername www.mydomian.com:80UseCanonicalName Off
 
  
 Options followsymlinks allowoverride None
 
  
   Options Indexes followsymlinks allowoverride all Order allow,deny
  
 DirectoryIndex index.html index.html.varAccessFileName htaccess# The above code is httpd original, #省略若干行 # The following code is found online, directly added at the end of the httpd, Set VirtualHost, #重新写一遍mydomian. com and sub.mydomian.com# browsers seem to open, but is it reasonable to write this? Namevirtualhost *:80
 
  
   ServerName mydomian.com serveralias www.mydomian.com documentroot/var/www/html 
   
    Option    
 S Indexes followsymlinks allowoverride all Order deny,allow Deny from all to 
   

  
 
 
  
   ServerName sub.mydomian.com serveralias www.sub.mydomian.com documentroot/var/www/html/sub 
   
     Options Indexes followsymlinks allowoverride all Order deny,allow Deny from all to ll
    

  
 



Reply to discussion (solution)


* Change to IP


* Change to IP
Is that all you need?

 
  
   
      ServerName sub.mydomian.com    serveralias www.sub.mydomian.com    documentroot/var/www/html/sub    
  
   
    
           Options Indexes followsymlinks        allowoverride all        Order deny,allow        Deny    
  from all to 
   
 
  

Do you want to add Namevirtualhost 2.3.4.5:80?

Yes, no need.
Give you a link http://jingyan.baidu.com/article/363872ec870f6e6e4ba16feb.html
It's a very clear description.

Thanks, now understand.

  • 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.