Compare commits

...

4 Commits

Author SHA1 Message Date
a4c8b789ad 2.0.35 2019-01-22 22:05:03 +01:00
b4378e305a fix(core): update 2019-01-22 22:05:02 +01:00
5ff0980908 2.0.34 2019-01-22 18:59:56 +01:00
e60257d761 fix(core): update 2019-01-22 18:59:55 +01:00
3 changed files with 4 additions and 15 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "@pushrocks/smartnginx",
"version": "2.0.33",
"version": "2.0.35",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -1,6 +1,6 @@
{
"name": "@pushrocks/smartnginx",
"version": "2.0.33",
"version": "2.0.35",
"private": false,
"description": "control nginx from node, TypeScript ready",
"main": "dist/index.js",

View File

@ -72,22 +72,12 @@ export let getBaseConfigString = () => {
};
export let getHostConfigString = (hostNameArg: string, destinationIpArg: string, destinationPortArg = 80) => {
const uniqueString = plugins.smartunique.shortId();
const hostConfig = plugins.smartstring.indent.normalize(`
upstream ${uniqueString} {
upstream ${hostNameArg} {
keepalive 100;
server ${destinationIpArg}:${destinationPortArg};
}
server {
# The keepalive parameter sets the maximum number of idle keepalive connections
# to upstream servers that are preserved in the cache of each worker process. When
# this number is exceeded, the least recently used connections are closed.
listen *:80 ;
server_name ${hostNameArg};
rewrite ^ https://${hostNameArg}$request_uri? permanent;
}
server {
listen *:443 ssl;
server_name ${hostNameArg};
@ -96,11 +86,10 @@ export let getHostConfigString = (hostNameArg: string, destinationIpArg: string,
location / {
proxy_http_version 1.1;
proxy_buffering off;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://${uniqueString};
proxy_pass http://${hostNameArg};
}
}
`);