apache2.4 about configuring multi-port virtual Web sites

Source: Internet
Author: User

I have already configured a site, now want to change to a number of sites, according to the online method need to change the site I originally configured the relevant information? Or does httpd-vhosts.conf directly cover the site I set up in httpd.conf?

Reply content:

I have already configured a site, now want to change to a number of sites, according to the online method need to change the site I originally configured the relevant information? Or does httpd-vhosts.conf directly cover the site I set up in httpd.conf?

Adding virtual sites is just a matter of configuring httpd.conf with VirtualHost configuration.

# *:80表示监听本机所有IP(需要配置有Listen 80),星号匹配所有地址,# 因此主服务器(httpd.conf里的DocumentRoot和ServerName)将不会处理任何请求.# 注意,第一个监听80端口VirtualHost将作为default server用于处理找不到匹配的80请求
  
   
    
       DocumentRoot "/path/to/default"    ServerName localhost
  
   
  
   
    
       DocumentRoot "/path/to/a.com"    ServerName a.com
  
   
  
   
    
       DocumentRoot "/path/to/b.com"    ServerName b.com
  
   

Try to modify the Hosts file
Add: 127.0.0.1 your domain

httpd-vhosts.conf Add a VirtualHost, restart the service is good, configure the official manual is very detailed, look at the understanding, it is not good to download a WAMPSERVER3 has automatic add virtualhost tools, learn a bit also line.

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