From 8ebde757b2a25926ebfd641ec7022e330a6fde99 Mon Sep 17 00:00:00 2001 From: LosslessBot Date: Wed, 6 Jul 2016 06:33:38 +0200 Subject: [PATCH] imrpove README --- README.md | 20 ++++++++++- nginxconfig/nginx.conf | 65 +++++++++++++++++++++++++++++++++++ package.json | 2 +- ts/smartnginx.snippets.ts | 71 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 156 insertions(+), 2 deletions(-) create mode 100644 nginxconfig/nginx.conf create mode 100644 ts/smartnginx.snippets.ts diff --git a/README.md b/README.md index 4ea8da7..4f09ccd 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,20 @@ # smartnginx -control nginx from node \ No newline at end of file +control nginx from node, TypeScript ready + +## Status +[![build status](https://gitlab.com/pushrocks/smartnginx/badges/master/build.svg)](https://gitlab.com/pushrocks/smartnginx/commits/master) + +## Usage +We recommend the use of TypeScript! :) + +```typescript +import * as smartnginx from "smartnginx"; +myNginxConfig = new smartnginx.NginxConfig(); +myNginxZone = new smartnginx.NginxZone({ + zoneName:"some.example.com", + type:"reverseProxy", + destination:"192.192.192.192" // some destination IP +}); +myNginxConfig.addZone(myNginxZone); // adds the zone to the config +myNginxConfig.deploy(); // deploys the referenced NginxConfig and restarts nginx +``` \ No newline at end of file diff --git a/nginxconfig/nginx.conf b/nginxconfig/nginx.conf new file mode 100644 index 0000000..d3180db --- /dev/null +++ b/nginxconfig/nginx.conf @@ -0,0 +1,65 @@ +user www-data; +worker_processes auto; +pid /run/nginx.pid; + +events { + worker_connections 768; + # multi_accept on; +} + +http { + server_names_hash_bucket_size 128; + + ## + # Basic Settings + ## + + sendfile on; + tcp_nopush on; + tcp_nodelay on; + keepalive_timeout 65; + types_hash_max_size 2048; + # server_tokens off; + + # server_names_hash_bucket_size 64; + # server_name_in_redirect off; + + include /etc/nginx/mime.types; + default_type application/octet-stream; + + ## + # SSL Settings + ## + + ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE + ssl_prefer_server_ciphers on; + + ## + # Logging Settings + ## + + access_log /var/log/nginx/access.log; + error_log /var/log/nginx/error.log; + + ## + # Gzip Settings + ## + + gzip on; + gzip_disable "msie6"; + + # gzip_vary on; + # gzip_proxied any; + # gzip_comp_level 6; + # gzip_buffers 16 8k; + # gzip_http_version 1.1; + # gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript; + + ## + # Virtual Host Configs + ## + + include /etc/nginx/conf.d/*.conf; + include /etc/nginx/sites-enabled/*; +} +daemon off; \ No newline at end of file diff --git a/package.json b/package.json index 9b24a29..ee24e29 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "smartnginx", "version": "0.0.1", - "description": "control nginx from node", + "description": "control nginx from node, TypeScript ready", "main": "dist/index.js", "typings": "dist/index.d.ts", "scripts": { diff --git a/ts/smartnginx.snippets.ts b/ts/smartnginx.snippets.ts new file mode 100644 index 0000000..d169525 --- /dev/null +++ b/ts/smartnginx.snippets.ts @@ -0,0 +1,71 @@ +let baseConfig = ` +user www-data; +worker_processes auto; +pid /run/nginx.pid; + +events { + worker_connections 768; + # multi_accept on; +} + +http { + server_names_hash_bucket_size 128; + + ## + # Basic Settings + ## + + sendfile on; + tcp_nopush on; + tcp_nodelay on; + keepalive_timeout 65; + types_hash_max_size 2048; + # server_tokens off; + + # server_names_hash_bucket_size 64; + # server_name_in_redirect off; + + include /etc/nginx/mime.types; + default_type application/octet-stream; + + ## + # SSL Settings + ## + + ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE + ssl_prefer_server_ciphers on; + + ## + # Logging Settings + ## + + access_log /var/log/nginx/access.log; + error_log /var/log/nginx/error.log; + + ## + # Gzip Settings + ## + + gzip on; + gzip_disable "msie6"; + + # gzip_vary on; + # gzip_proxied any; + # gzip_comp_level 6; + # gzip_buffers 16 8k; + # gzip_http_version 1.1; + # gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript; + + ## + # Virtual Host Configs + ## + + include /etc/nginx/conf.d/*.conf; + include /etc/nginx/sites-enabled/*; +} +daemon off; +` + +let zoneConfig = ` + +` \ No newline at end of file