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
Configurationapache
OfVirtualHost
Take my project as an example:
Findhttpd.conf
And 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 makeapache
Listen to port 80, that is, the default port.admin.example.com
The request is distributed8080
Port application. When a user accesseswww.demo.com
The request is distributed8081
Port. 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.