Setting a new IP as a subfolder of an existing IP
I'm pretty new to Apache configurations... is the following possible?
I have 2 separate web servers, each hosting a different application - totally separate.
My main application is under the domain www.example.com
. What I want to do is set the other server's domain to something like www.example.com/newapp
so that when users go to this URL, they will be redirected to the 2nd server (which is a totally different domain/IP/virtualhost); pages under this second server's url will always be www.example.com/newapp/xxxx
.
NOTE: there is nothing matching this directory structure under the first, main application.
Basically, the www.example.com/newapp/
application is compl开发者_Go百科etely separate, but I want users to think its actually the same website.
You need to configure the first server handling all example.com requests to proxy requests to the new server when a request for example.com/newapp is received. This will cost you bandwidth on both sides, beware of that.
Using ProxyPass & ProxyPassReverse should suffice. If you want hyperlink conversion as well, you need to use mod_proxy_html
ProxyPass /newapp/ http://xx.xx.xx.xx/newapp
ProxyPassReverse /newapp/ http://xx.xx.xx.xx/newapp
mod_proxy_html: http://apache.webthing.com/mod_proxy_html/
<VirtualHost *:80>
UseCanonicalName Off
ProxyPass /newapp/ http://xx.xx.xx.xx/
ProxyPassReverse /newapp/ http://xx.xx.xx.xx/
Include /etc/apache2/conf/railsapp.conf
</VirtualHost>
精彩评论