简体   繁体   English

如何将angular-fullstack应用程序迁移到具有基本URL的域

[英]How to migrate angular-fullstack app to a domain with a base URL

I have a fairly complicated issue in that I originally developed a MEAN app with the Yeoman fullstack-angular generator with no base URL. 我有一个相当复杂的问题,因为我最初是使用Yeoman Fullstack-Angular生成器开发的MEAN应用程序,没有基本URL。 In development http://localhost:9000/ worked just fine. 在开发中, http:// localhost:9000 /正常工作。

Moving into production, I'm using a reverse Apache proxy with a particular path example.com/foo to serve http://localhost:9000 . 进入生产阶段,我正在使用带有特定路径example.com/foo的反向Apache代理来提供http:// localhost:9000 Now when I load up example.com/foo I get a bunch of 404 errors (of course) because eg example.com/app, example.com/bower_components don't exist. 现在,当我加载example.com/foo时,我会收到一堆404错误(当然),因为例如example.com/app、example.com/bower_components不存在。

I'm a little out of my league here and no where to start, is there some Express/Angular/etc config variables I should be looking at to help with this migration? 我在这里有点陌生,没有起点,我应该寻找一些Express / Angular / etc配置变量来帮助进行迁移吗?

server/config/express.js yielded no hints and I can't find anything in the Grunt file to make wiredep compile the correct links. server / config / express.js没有任何提示,我在Grunt文件中找不到任何东西可以使Wiredep编译正确的链接。 Or maybe there is even a way to do this in Apache... 或者也许甚至有一种方法可以在Apache中执行此操作...

To clarify, the issue was that I need to deploy a MEAN app behind a base URL /foo. 为了澄清,问题是我需要在基本URL / foo后面部署MEAN应用。 Do that I: 我这样做:

1) Used the following Apache rules: 1)使用了以下Apache规则:

RewriteEngine on
RewriteRule ^/foo/(.*)$ http://localhost:9000/$1 [P]

2) Now we just need to just make all requests go to example.com/foo/whatever. 2)现在,我们只需要将所有请求发送到example.com/foo/whatever。 Edit the base tag in index.html to be: 将index.html中的基本标记编辑为:

<base href="/foo/" />

3) Made all hrefs and service calls relative instead of absolute (Angular providers works with the <base> tag) 3)使所有href和服务调用相对而不是绝对(Angular提供程序与<base>标记一起使用)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何部署yeoman angular-fullstack项目? - how to deploy yeoman angular-fullstack project? Passport Facebook与angular-fullstack应用程序的集成未将用户会话保存为angular-fullstack结构 - Passport Facebook integration with angular-fullstack app not saving user session in angular-fullstack structure 如何在基于 angular-fullstack 的应用程序中包含库文件 (css/js) - How to include library files (css/js) in angular-fullstack based app 将PostgreSQL数据库连接到使用Angular-fullstack生成的Web应用程序 - Connecting PostgreSQL DB to Web App Generated with Angular-fullstack 在angular-fullstack应用程序中更新后,单个帖子不同步 - Single post not synching after updating in angular-fullstack app 将angular-fullstack部署到Azure - Deploying angular-fullstack to Azure 如何在Angular-Fullstack生成的Angular 1.5组件中注入依赖项 - How to inject dependency in Angular 1.5 component generated by Angular-Fullstack 使用angular-fullstack结构 - Using angular-fullstack structure 角全堆栈运行如何表示为恶魔? - How does the angular-fullstack run express as a deamon? 如何在没有服务器组件的情况下使用Angular-fullstack? - How to use Angular-fullstack without server components?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM