Compare commits
18 Commits
Author | SHA1 | Date | |
---|---|---|---|
5c4d5a4a85 | |||
1be3f7f388 | |||
8c2aa23406 | |||
d2d4ad70ce | |||
e3817f92c7 | |||
159c043ba6 | |||
fbdb98c355 | |||
b81dc319e2 | |||
eec249d68f | |||
0f4a5b0cc1 | |||
20c23751a4 | |||
6aaae7683b | |||
826ae9f157 | |||
9dbeef0ed2 | |||
53f6daa5d5 | |||
9ee5cd2a3d | |||
13c27bb71e | |||
2be54dd505 |
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartnginx",
|
"name": "@pushrocks/smartnginx",
|
||||||
"version": "2.0.40",
|
"version": "2.0.49",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartnginx",
|
"name": "@pushrocks/smartnginx",
|
||||||
"version": "2.0.40",
|
"version": "2.0.49",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "control nginx from node, TypeScript ready",
|
"description": "control nginx from node, TypeScript ready",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
|
@ -119,11 +119,11 @@ export class SmartNginx {
|
|||||||
|
|
||||||
// write standard self signed certificate
|
// write standard self signed certificate
|
||||||
const selfsignedCert = plugins.selfsigned.generate([{ name: 'commonName', value: 'selfsigned.git.zone' }], { days: 365});
|
const selfsignedCert = plugins.selfsigned.generate([{ name: 'commonName', value: 'selfsigned.git.zone' }], { days: 365});
|
||||||
plugins.smartfile.memory.toFsSync(selfsignedCert.private, plugins.path.join(paths.nginxConfigDirPath, './default.private.pem'));
|
|
||||||
plugins.smartfile.memory.toFsSync(selfsignedCert.public, plugins.path.join(paths.nginxConfigDirPath, './default.public.pem'));
|
|
||||||
|
|
||||||
// deploy hosts
|
// deploy hosts
|
||||||
plugins.smartfile.fs.ensureEmptyDirSync(paths.nginxHostDirPath);
|
plugins.smartfile.fs.ensureDirSync(paths.nginxHostDirPath);
|
||||||
|
plugins.smartfile.memory.toFsSync(selfsignedCert.private, plugins.path.join(paths.nginxHostDirPath, './default.private.pem'));
|
||||||
|
plugins.smartfile.memory.toFsSync(selfsignedCert.cert, plugins.path.join(paths.nginxHostDirPath, './default.public.pem'));
|
||||||
for (const host of this.deployedHosts.getArray()) {
|
for (const host of this.deployedHosts.getArray()) {
|
||||||
await host.deploy();
|
await host.deploy();
|
||||||
this.logger.log('info', `Host ${host.hostName} deployed!`);
|
this.logger.log('info', `Host ${host.hostName} deployed!`);
|
||||||
@ -134,4 +134,13 @@ export class SmartNginx {
|
|||||||
this.hostCandidates.wipe();
|
this.hostCandidates.wipe();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* stops the smartnginx instance
|
||||||
|
*/
|
||||||
|
public async stop() {
|
||||||
|
if (this.nginxProcess) {
|
||||||
|
await this.nginxProcess.stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,28 +64,17 @@ export let getBaseConfigString = (defaultProxy: string) => {
|
|||||||
##
|
##
|
||||||
|
|
||||||
server {
|
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 default_server;
|
listen *:80 default_server;
|
||||||
rewrite ^ ${defaultProxy} permanent;
|
server_name selfsigned.git.zone;
|
||||||
|
rewrite ^ ${defaultProxy} redirect;
|
||||||
}
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen *:443 ssl default_server;
|
listen *:443 ssl default_server;
|
||||||
|
server_name selfsigned.git.zone;
|
||||||
ssl_certificate ${paths.nginxHostDirPath}/default.public.pem;
|
ssl_certificate ${paths.nginxHostDirPath}/default.public.pem;
|
||||||
ssl_certificate_key ${paths.nginxHostDirPath}/default.private.pem;
|
ssl_certificate_key ${paths.nginxHostDirPath}/default.private.pem;
|
||||||
location / {
|
rewrite ^ ${defaultProxy} redirect;
|
||||||
proxy_http_version 1.1;
|
|
||||||
proxy_buffering off;
|
|
||||||
proxy_redirect off;
|
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-For $remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
|
||||||
proxy_next_upstream error timeout http_404 http_429 http_500 http_502;
|
|
||||||
proxy_next_upstream_tries 5;
|
|
||||||
proxy_pass ${defaultProxy};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
include ${paths.nginxHostDirPath}/*.conf;
|
include ${paths.nginxHostDirPath}/*.conf;
|
||||||
|
Reference in New Issue
Block a user