Subdirectory on a different host
I've got a site www.example.com on one server. I'd like to create www.e开发者_JAVA技巧xample.com/blog on another server/host.
A) Can I do this? B) How can I do this?
I've read a bit on using Apache's mod_proxy, proxypass, and ProxyPassReverse, but I'm not gifted enough with Apache or server mgt to know if I'm on the right track or not. Or, if there are other options to doing what I want.
To be clear, I do not want a subdomain like blog.example.com. I know how I COULD do that with DNS, but I don't believe DNS is an option for subdirectories.
This is not doable nicely IMO. As you say, you would need a proxy based solution that fetches the content from the blog server and serves it to the user.
That has the serious downside that any traffic on your blog will have to run through your primary host, eating up bandwidth, resources and traffic volume.
Is a redirect (i.e. www.domain.com/blog
doing a header redirect [visible in the browser's address bar] to blog.otherhost.com
) an option?
If not, check out the documentation on mod_proxy. The basic example for a reverse proxy looks good already:
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass /foo http://foo.example.com/bar
ProxyPassReverse /foo http://foo.example.com/bar
精彩评论