After registering the domain name, multiple PHP projects can be bound with multiple domain names separately

Source: Internet
Author: User
I registered a number of domain names, the server is deployed in Apache running multiple PHP projects, you can use multiple domain names are bound? How to bind?

Reply content:

I registered a number of domain names, the server is deployed in Apache running multiple PHP projects, you can use multiple domain names are bound? How to bind?

OK. You can use VirtualHost.
Your domain first uses a record to resolve all the IP of the server
Edit http-vhost.conf Configuration


  
   
    
       DocumentRoot "D:/UPUPW_AP5.5/vhosts/hospital.com/web"    ServerName hospital.com:80    ServerAlias    ServerAdmin webmaster@hospital.com    DirectoryIndex index.html index.htm index.php default.php app.php u.php    ErrorLog logs/hospital.com-error.log    CustomLog logs/hospital.com-access_%Y%m%d.log comonvhost
   
    
     
        Options FollowSymLinks    AllowOverride All    Require all granted
   
    
   
    
     
        Require all denied
   
    
   
    
     
        Require all denied
   
    
  
   //D:/UPUPW_AP5.5/vhosts/hospital.com/web    WEB目录//ServerName hospital.com:80 绑定的域名

Configured apache VirtualHost , take my project as an example:
Locate the server httpd.conf , and then configure the following:


  
   
    
        ServerName admin.example.com     ProxyPass / http://localhost:8080/     ProxyPassReverse / http://localhost:8080/     ErrorLog logs/admin.example.com-error_log     CustomLog logs/admin.example.com-access_log common 
  
   
  
   
    
        ServerName www.demo.com     ProxyPass / http://localhost:8081/     ProxyPassReverse / http://localhost:8081/     ErrorLog logs/demo.com-error_log     CustomLog logs/demo.com-access_log common 
  
   

The above configuration is to let the apache listening 80 port, also is the default port, and then when admin.example.com the user accesses, the request is distributed to the 8080 port application. When the user accesses www.demo.com , the request is distributed to the 8081 port. Of course, how many programs you need to configure VirtualHost . If you do not understand, you can search apache端口转发 , many tutorials oh.

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