【问题标题】:How can i run an angular 6 application in wamp?如何在 wamp 中运行 Angular 6 应用程序?
【发布时间】:2020-01-03 14:13:31
【问题描述】:

我有一个 Angular 6 应用程序,我想安装在 Apache 服务器上,这可能吗? 我不想安装 ngix。是否可以在 Apache 服务器上运行应用程序?

【问题讨论】:

标签: node.js angular mean-stack


【解决方案1】:

如果您必须部署 Angular 应用程序,您可以按照此链接的说明进行操作:

'https://angular.io/guide/deployment'

只需使用 'ng build' 构建项目,然后复制 './dist/' 中的文件夹,并在 apache 服务器 www 目录中使用您的项目名称。

【讨论】:

  • 我试过这样做。但是当我查看该站点时,我的页面变为空白。
  • index.html中的href路径配置正确了吗?
【解决方案2】:

您当然可以使用 Apache 为您的应用程序提供服务。

您需要根据您的 Angular 应用程序目录配置您的 DocumentRoot。

另外,您需要像下面这样配置 ReWriteEngine:

RewriteEngine On
# If an existing asset or directory is requested go to it as it is
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d
RewriteRule ^ - [L]

# If the requested resource doesn't exist, use index.html
RewriteRule ^ /index.html

点击链接了解更多详情: https://angular.io/guide/deployment

谢谢你, 单位

【讨论】:

    猜你喜欢
    • 2019-11-03
    • 1970-01-01
    • 2018-12-14
    • 2018-11-15
    • 2019-01-27
    • 1970-01-01
    • 2019-01-08
    • 2019-06-25
    • 1970-01-01
    相关资源
    最近更新 更多