Apache two domain names windows directory binding configuration

Usually we registered the domain names are top-level domains such as www.potatog.com, we hope that this domain can access different web server or different and much more may this www.potatog.com/api or www.potatog.com/admin, ,, another way two domain names point to a specific directory api.potatog.com

Add the following content in httpd.conf

Top-level domains specify a directory

<VirtualHost *:80>
  ServerAdmin [email protected]
  DocumentRoot "C:\xampp\htdocs\"
  ServerName www.potatog.com
  ErrorLog "C:\xampp\apache\logs\www.potatog.localhost-error.log"
  CustomLog "C:\xampp\apache\logs\www.potatog.localhost.access.log" combined
</VirtualHost>

Two domain names specify a directory

<VirtualHost *:80>
  ServerAdmin [email protected]
  DocumentRoot "C:\xampp\htdocs\api"
  ServerName api.potatog.com
  ErrorLog "C:\xampp\apache\logs\api.potatog.localhost-error.log"
  CustomLog "C:\xampp\apache\logs\api.potatog.localhost.access.log" combined
</VirtualHost>

reference:

https://www.cnblogs.com/phonecom/p/6363268.html

 

Guess you like

Origin www.cnblogs.com/potatog/p/11027762.html