IIS Config - v22-appfactory/appfactory-wiki GitHub Wiki

IIS (Windows Internet Information Services) configuration builds on the Windows Configuration replacing the commandline and IDE running of the services and web applications and instead running in them in IIS and PM2. IIS also provides a reverse-proxy and allows the applications to be run from the browser using SSL/HTTPS.

Environmental Variables running in IIS

The following changes to the environment variables are needed for running in IIS using HTTPS:
VUE_APP_PROTOCOL=https
VUE_APP_REST_HOST=guest IP/api
VUE_APP_REST_PORT removed or empty
VUE_APP_WEB_PORT removed or empty

Creating a Production Build

The Node projects can produce a production build by setting the NODE_ENV=production and running the project build:

set NODE_ENV=production
npm run build

This was done in both the services and the web project directories and populates the ./dist directory.

PM2

PM2 is a daemon process manager that will help you manage and keep your application online 24/7

npm install pm2@latest -g

Services REST API

The services application is run in PM2 in order to provide a Process Manager for running the Node application.

cd \workspace\services
pm2 start dist/index.js

IIS Configuration

Rewrite Plugin

The rewrite plugin was downloaded from https://www.iis.net/downloads/microsoft/url-rewrite and installed.

Two IIS websites were created: Appfactory and Web. The Appfactory application is used as a reverse-proxy which will redirect HTTPS requests to the services (running in PM2) and web applications. The Web website runs a web site from the \workspace\appfactory\dist directory.

Application Website

Create a website called Appfactory using IIS and Development Certificates. Add two URL rewrite rules for sending HTTPS requests to the Services and Web applications running on the localhost. Application Website Bindings


Application Website URL Rewrite Rules

NOTE: The rewrite rule for the services using api/ in the URL will rewrite the call to http://localhost:3000 removing the api from the URL. The rewrite rule for the web application sends the request to http://localhost:8080. It is important that the services rule precedes the web rule.

Web Website

Create a website called Web using HTTP and port 8080. Set the physical path to the 'appfactory/dist' directory.
Web Website Bindings

NOTES

  • Any changes to the source require a rebuild of the ./dist directory.
  • Changes to the web application require that the Web website be restarted to guarantee that the page will not be cached.
⚠️ **GitHub.com Fallback** ⚠️