简体   繁体   English

我如何使用 nginx 作为 angular 6 应用程序的服务器?

[英]How I can use nginx as server for angular 6 application?

I want to open the browser index.html for the application that runs under nginx and then open the application for anguar-cli (angular 6).我想打开nginx下运行的应用程序的浏览器index.html,然后打开anguar-cli(angular 6)的应用程序。 Wherever I read it everywhere it says create the angular application and start him server.无论我在哪里读到它,它都会说创建角度应用程序并启动他的服务器。 I'm lost.我迷路了。 I think it's possible to work angular 6 using a server other than delivered in the Angular 6 box.我认为可以使用 Angular 6 盒子中提供的服务器以外的服务器来运行 angular 6。 If possible, tell me how.如果可以,告诉我怎么做。 Please help me understand the mechanism of the Angular 6.请帮助我理解 Angular 6 的机制。

You used the angular-clt tag, so i think with "server delivered in the Angular 6 box" you mean the one started with ng serve .您使用了 angular-clt 标签,所以我认为“在 Angular 6 框中交付的服务器”是指以ng serve开头的那个。

ng serve just starts the development server with change detection and auto-rebuild for your source files und (without extra parameters) also builds a debug version of your angular appication. ng serve只是启动带有更改检测和自动重建源文件的开发服务器,并且(没有额外参数)还构建了角度应用程序的调试版本。

To build the production files use要构建生产文件,请使用

ng build --prod

as described in https://github.com/angular/angular-cli/wiki/build or https://angular.io/guide/deployment and then copy the files from dist directory to your web server.https://github.com/angular/angular-cli/wiki/buildhttps://angular.io/guide/deployment 中所述,然后将文件从 dist 目录复制到您的 Web 服务器。

If your application makes use of the router and you move it to a sub-directory of your server, you must take care of the correct <base href>如果您的应用程序使用路由器并将其移动到服务器的子目录中,则必须注意正确的<base href>

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

相关问题 如何在PHP应用程序中使用Angular 2? - How can I use Angular 2 in PHP application? 如何获取我的 Angular 应用程序的 Firestore 服务器日期 - How can I get the firestore server date for my angular application 如何在 Angular2 应用程序中使用 MediaRecorder 对象? - How can I use a MediaRecorder object in an Angular2 application? 如何将JointJS与使用Angular CLI构建的应用程序一起使用? - How can I use JointJS with an application built with Angular CLI? 如何在Spring Boot应用程序中使用Angular2 PathLocationStrategy? - How can I use Angular2 PathLocationStrategy in a Spring Boot application? 如何在我的 Angular 应用程序中使用 Firebase Admin SDK? - How can I use Firebase Admin SDK in my Angular application? 如何在Angular 2应用程序中使用@types依赖关系? - How can I use @types dependencies in my Angular 2 application? 我可以在 angular 9 应用程序中使用查询选择器吗 - Can i use queryselector in angular 9 application 如何在服务器上的Nginx上部署Laravel 5.7和Angular 7 - How do i deploy Laravel 5.7 and Angular 7 on a Nginx on a server 用Docker在nginx服务器上部署angular应用欢迎来到nginx - Deploy angular application on nginx server with Docker Welcome to nginx
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM