Is it possible, using only Apache, to point a subdomain at a specific IP address?
We currently have a primary domain(www.example.com) with 250+ subdomains(site1.example.com, site2.example.com, etc). Due to rules regarding an SSL cert, we now have to place www.example.com on it's own IP address(although it still resides on the 开发者_Go百科same server).
The subdomains are currently configured as alias records, so creating 250+ new A records for each subdomain would be a major hassle.
I would love an Apache-based solution to this problem so that I don't have to spend the rest of my day configuring DNS records.
You can make mod_proxy pass all requests from one virtual host to another server, which sounds like exactly what you're looking for.
<VirtualHost *:80>
ServerAdmin you@your.com
ServerName your.vhost.your.com
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyErrorOverride On
ProxyPass / http://your.realhost.com/
ProxyPassReverse / http://your.realhost.com/
<Location />
Order allow,deny
Allow from all
</Location>
</VirtualHost>
You could also do this with mod_rewrite and the [P] option, which can give you a lot more flexibility.
精彩评论