After registering a domain name, can multiple php projects be bound with multiple domain names?

Source: Internet
Author: User
I have registered several domain names. can I bind multiple domain names to multiple php projects running on apache deployed on the server? How to bind it? I have registered several domain names. can I bind multiple php projects running on apache deployed on the server with multiple domain names? How to bind

Reply content:

I have registered several domain names. can I bind multiple domain names to multiple php projects running on apache deployed on the server? How to bind

Yes. Use virtualhost.
Your domain name first uses A record to resolve all IP addresses to 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 Directory // ServerName hospital.com: 80 bound domain name

ConfigurationapacheOfVirtualHostTake my project as an example:
Findhttpd.confAnd configure the following content:


  
        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 makeapacheListen to port 80, that is, the default port.admin.example.comThe request is distributed8080Port application. When a user accesseswww.demo.comThe request is distributed8081Port. Of course, how many programs do you need to configure?VirtualHost. If you still do not understand, you can searchApache port forwarding, A lot of tutorials.

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.