Angular20 nginx安装,angular项目部署

1 nginx安装(Windows版本)   1.1 下载安装包

    到官网下载Windows版本的nginx安装包

    技巧01:下载好的压缩包解压即可,无需安装

    

Angular20 nginx安装,angular项目部署

  1.2 启动nginx

    进入到解压目录,点击 nginx.exe 就可以启动nginx啦

    

Angular20 nginx安装,angular项目部署

  1.3 验证

    打开浏览器,跳转到  后如果出现下面的页面就说明nginx安装成功啦

    

Angular20 nginx安装,angular项目部署

   1.4 参考文档

    Windows下nginx安装及其配置

    Windows下nginx命令使用

    Windows下nginx配置解释

2 angular项目部署   2.1 项目打包

    对angular项目进行打包处理,打包好后在angular项目的根目录会出现一个dist文件夹,该文件夹存放的就是打包好的项目文件

    

Angular20 nginx安装,angular项目部署

     技巧01:需要到 package.json 中去修改 ng build 指令

    

Angular20 nginx安装,angular项目部署

Angular20 nginx安装,angular项目部署

Angular20 nginx安装,angular项目部署

{ "name": "qcbx", "version": "0.0.0", "license": "MIT", "scripts": { "ng": "ng", "start": "ng serve", "build": "ng build --prod --base-href /qcbx/", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e" }, "private": true, "dependencies": { "@angular/animations": "^5.2.5", "@angular/cdk": "^5.2.2", "@angular/common": "^5.2.0", "@angular/compiler": "^5.2.0", "@angular/core": "^5.2.0", "@angular/forms": "^5.2.0", "@angular/http": "^5.2.0", "@angular/material": "^5.2.2", "@angular/platform-browser": "^5.2.0", "@angular/platform-browser-dynamic": "^5.2.0", "@angular/router": "^5.2.0", "core-js": "^2.4.1", "hammerjs": "^2.0.8", "rxjs": "^5.5.6", "zone.js": "^0.8.19" }, "devDependencies": { "@angular/cli": "~1.7.0", "@angular/compiler-cli": "^5.2.0", "@angular/language-service": "^5.2.0", "@types/jasmine": "~2.8.3", "@types/jasminewd2": "~2.0.2", "@types/node": "~6.0.60", "codelyzer": "^4.0.1", "jasmine-core": "~2.8.0", "jasmine-spec-reporter": "~4.2.1", "karma": "~2.0.0", "karma-chrome-launcher": "~2.2.0", "karma-coverage-istanbul-reporter": "^1.2.1", "karma-jasmine": "~1.1.0", "karma-jasmine-html-reporter": "^0.2.2", "protractor": "~5.1.2", "ts-node": "~4.1.0", "tslint": "~5.9.1", "typescript": "~2.5.3" } }

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/zywsxp.html