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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 21:17:09  来源:igfitidea点击:

How to deploy a html or javascript app in Apache http server

eclipseapache

提问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

添加服务器

  1. Window -> Show View -> Servers
  2. Right click inside Serverstab
  3. New - > Server -> HTTP Server -> Next
  4. add publishing dir: in my case (C:\Program Files (x86)\Apache Group\Apache2\htdocs)
  5. Next -> add port (8080 in my case)
  1. Window -> Show View -> Servers
  2. 右键单击Servers选项卡内
  3. 新建 -> 服务器 -> HTTP 服务器 -> 下一步
  4. 添加发布目录:在我的情况下 ( C:\Program Files (x86)\Apache Group\Apache2\htdocs)
  5. 下一步 -> 添加端口(在我的例子中是 8080)

Create a web project

创建一个网络项目

  1. Switch to Web View (Right hand top corner)
  2. Right click Project Explorer in left
  3. New -> Project -> Web -> Static Web Project
  4. Name the Project
  5. Select Runtime Target as HTTP Server
  6. Next -> Notice your default context root
  7. Finish
  1. 切换到 Web 视图(右上角)
  2. 右键单击左侧的 Project Explorer
  3. 新建 -> 项目 -> Web -> 静态 Web 项目
  4. 命名项目
  5. 选择运行时目标作为 HTTP 服务器
  6. 下一步 -> 注意你的默认上下文根
  7. 结束

Copy your current js and html files in the 'WebContent' directory in Project Explorer.

将当前的 js 和 html 文件复制到 Project Explorer 的“WebContent”目录中。



In Servers Tab

在服务器选项卡中

  1. Right click HTTP Server
  2. Add - Remove -> Add your project -> Finish
  3. Right click Http Server -> Publish 4 done!
  1. 右键单击 HTTP 服务器
  2. 添加 - 删除 -> 添加您的项目 -> 完成
  3. 右键单击 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.

此外,对于这个问题,是值得一读的。