具有 tomcat 的 Apache Web 服务器

Apache web server with tomcat

我们有一个 java Web 应用程序,其构建配置 gradle 包含 2 个模块,如下所示:

  1. project-web.war -- 包含所有 statc 文件、js、jsp 等。它还包含所有项目、spring 配置和 rest 控制器图层.

  2. project-main.jar -- 包含所有业务&DAO层逻辑。

目前我们正在 Apache tomcat 中部署这两个模块。我们的项目正在进行一些架构更改,其中一项要求是在 Apache 服务器中添加所有静态内容,以便可以快速提供静态内容。

我是 Apache http 网络服务器的初学者。我有以下问题:

  1. 如果我把所有的静态内容都放在Apache http服务器中,那么我可以从project-web中删除所有的静态内容吗?这两个项目可以单独存在吗?

  2. 项目的未来静态内容将在 Apache http 网络服务器中,网络应用程序将部署在 Apache tomcat,此外,这两个服务器将在不同的 VM 机器中。 tomcat 中的 Web 应用程序如何从不同 VM 机器上的 Apache Web 服务器访问静态内容?(例如 jsp 如何指向图像?)

  3. 为静态内容创建一个单独的项目是否是个好主意,因为它将来会独立于 Web 项目并且只需要部署在 Apache http 服务器中?

以上问题的答案将是可观的,也欢迎其他相关建议。谢谢!

1) If I put all the static contents in Apache http server, then can I remove all the static contents from project-web?

是的。

Can both of these project exist separately?

他们可以,但是网络应用程序中的内容永远(不应该)被访问,那有什么意义呢?

2) Going forward static content of project will be in Apache http web server and web app will be deployed in Apache tomcat, in addition both of these server will be in different VM machine. How web app in tomcat can access static content from Apache web server in different VM machine?(E.g. how jsp can point to images?)

网络应用不需要访问图像。浏览器需要访问图像。可以设置 Apache HTTPD 配置以透明地处理该问题,而无需任何 JSP 更改。

3) Would it be fine idea to create a separate project for just static content as it will independent of web project in future and just need to be deployed in Apache http server?

是的。