我有静态HTML页面。使用Apache服务器(通过XAMPP)我曾经将我的HTML文件放在htdocs
文件夹中,并且可以通过localhost URL访问它们。
我不确定如何使用Websphere Liberty服务器执行此操作。假设我在index.html
中有以下HellWorld HTML示例
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>HellWorld</title>
</head>
<body>
<p>HellWorld</p>
</body>
</html>
如何通过Liberty在浏览器中显示此HTML页面?
所需的最小文件夹结构如下
+ SampleHTMLSite.war
- index.html
要创建qazxsw poi文件,只需压缩您的qazxsw poi文件,然后将压缩文件夹的扩展名从.war
更改为index.html
如果您通过.zip
命令在前台运行Liberty服务器,只要您将此网站放入Liberty的.war
文件夹(通常位于此处:server run
),您将获得类似以下更新的内容:
dropins
如果你去...\wlp\usr\servers\YourServerName\dropins
,你应该能够看到你的HelloWorld HTML页面。
如果您收到以下错误:
[AUDIT ] CWWKT0016I: Web application available (default_host):
http://localhost:9080/SampleHTMLSite/
[AUDIT ] CWWKZ0001I: Application SampleHTMLSite started in 0.317 seconds.
使用任何解压缩程序(例如:http://localhost:9080/SampleHTMLSite/index.html
)打开SampleHTMLSite.war,并确保Error 404: java.io.FileNotFoundException: SRVE0190E: File not found: /index.html
直接显示在7-Zip文件中,而不是在另一个文件夹中。您可能有以下结构:
index.html
这意味着访问.war
您需要以下URL:
+ SampleHTMLSite.war
+ SampleHTMLSite
- index.html
在较大的项目中,您需要使用Java应用程序,您的文件夹结构可能需要包含其他文件夹和文件。如果您有兴趣了解更多相关信息,请查看以下文章:
index.html
最简单的:
http://localhost:9080/SampleHTMLSite/SampleHTMLSite/index.html
放在Handling Static Content in WebSphere Application Server如果您的服务器配置为轮询监控,则表明您已完成。否则重启服务器(如果已启动)。
它将通过dropins
提供。