web apps on localhost on different ports accessed via port 80

白昼怎懂夜的黑 提交于 2019-12-06 01:37:46

I would do this using mod_rewrite and mod_proxy. For example (the following rules go into your VirtualHost configuration):

RewriteEngine On
RewriteRule ^/app1(.*)$ http://localhost:3000/$1 [P]
RewriteRule ^/app2(.*)$ http://localhost:3001/$1 [P]
RewriteRule ^/app3(.*)$ http://localhost:3002/$1 [P]

These rules use mod_rewrite's [P] flag to proxy the request. You'll need to make sure that mod_proxy, mod_proxy_http and mod_rewrite are all loaded in your main apache configuration by adding/uncommenting:

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule rewrite_module modules/mod_rewrite.so

Yes you can. Googling "mod_proxy tutorial" has plenty of results...

In particular you'll want to use mod_proxy_ajp if your server supports the AJP protocol. (Such as Tomcat.)

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!