Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate with nginx unit #8

Open
academici opened this issue Nov 28, 2018 · 0 comments
Open

Integrate with nginx unit #8

academici opened this issue Nov 28, 2018 · 0 comments

Comments

@academici
Copy link

Nginx Unit from the version 1.5 supports nodejs applications (http://unit.nginx.org/configuration/#go-node-js-applications)

To start, you need to write a script like

#!/usr/bin/env node

const {
  createServer,
  IncomingMessage,
  ServerResponse,
} = require('unit-http')

require('http').ServerResponse = ServerResponse
require('http').IncomingMessage = IncomingMessage

const express = require('express')

const app = express()

app.get('/', (req, res) => {
  res.set('X-Unit-Type', 'Absolute')
  res.send('Hello, Unit!')
})

createServer(app).listen()

and integrate with uvue server adapters https://universal-vue.github.io/docs/guide/server.html#adapters

...combined with this configuration...

{
  "listeners": {
    "*:8080": {
      "application": "hello-unit"
    }
  },
  "applications": {
    "hello-unit": {
      "type": "external",
      "working_directory": "/path/to/project",
      "executable": "app.js"
    }
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants