eclipse 如何在 Apache http 服务器中部署 html 或 javascript 应用程序
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12036205/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to deploy a html or javascript app in Apache http server
提问by User_AA
Could you please point me towards some documentation about deploying web application which consists of html and javascript to an apache http server instance using Eclipse ?
您能否指点我一些有关使用 Eclipse 将包含 html 和 javascript 的 Web 应用程序部署到 apache http 服务器实例的文档?
回答by Ashutosh Jindal
Adapted to latest Apache 2.4 using the instructions here:
使用此处的说明适应最新的 Apache 2.4 :
Requirements : Apache Server (I downloaded v2.4 from here)
要求:Apache 服务器(我从这里下载了 v2.4 )
Publishing Static Content and JavaScript on Apache Server using Eclipse
使用 Eclipse 在 Apache 服务器上发布静态内容和 JavaScript
Add Server
添加服务器
Window -> Show View -> Servers
- Right click inside
Servers
tab - New - > Server -> HTTP Server -> Next
- add publishing dir: in my case (
C:\Program Files (x86)\Apache Group\Apache2\htdocs
) - Next -> add port (8080 in my case)
Window -> Show View -> Servers
- 右键单击
Servers
选项卡内 - 新建 -> 服务器 -> HTTP 服务器 -> 下一步
- 添加发布目录:在我的情况下 (
C:\Program Files (x86)\Apache Group\Apache2\htdocs
) - 下一步 -> 添加端口(在我的例子中是 8080)
Create a web project
创建一个网络项目
- Switch to Web View (Right hand top corner)
- Right click Project Explorer in left
- New -> Project -> Web -> Static Web Project
- Name the Project
- Select Runtime Target as HTTP Server
- Next -> Notice your default context root
- Finish
- 切换到 Web 视图(右上角)
- 右键单击左侧的 Project Explorer
- 新建 -> 项目 -> Web -> 静态 Web 项目
- 命名项目
- 选择运行时目标作为 HTTP 服务器
- 下一步 -> 注意你的默认上下文根
- 结束
Copy your current js and html files in the 'WebContent' directory in Project Explorer.
将当前的 js 和 html 文件复制到 Project Explorer 的“WebContent”目录中。
In Servers Tab
在服务器选项卡中
- Right click HTTP Server
- Add - Remove -> Add your project -> Finish
- Right click Http Server -> Publish 4 done!
- 右键单击 HTTP 服务器
- 添加 - 删除 -> 添加您的项目 -> 完成
- 右键单击 Http Server -> 发布 4 完成!
You should be able to see your stuff in publishing directory. you can access the page at
您应该能够在发布目录中看到您的内容。您可以访问该页面
http://localhost:<port>/context_root
http://localhost:<port>/context_root
Also, thisis a worthwhile read for this question.
此外,对于这个问题,这是值得一读的。