{"id":15289017,"url":"https://github.com/makenova/nodeginx","last_synced_at":"2025-04-13T08:11:35.635Z","repository":{"id":143759217,"uuid":"43380738","full_name":"makenova/nodeginx","owner":"makenova","description":"manage nginx virtual host configs with node","archived":false,"fork":false,"pushed_at":"2017-11-22T23:54:05.000Z","size":56,"stargazers_count":11,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-27T00:05:33.682Z","etag":null,"topics":["nginx","nodejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/makenova.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-09-29T16:49:25.000Z","updated_at":"2023-08-20T15:49:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"725b210f-e3fd-4171-89dc-98f374b61b15","html_url":"https://github.com/makenova/nodeginx","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/makenova%2Fnodeginx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/makenova%2Fnodeginx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/makenova%2Fnodeginx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/makenova%2Fnodeginx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/makenova","download_url":"https://codeload.github.com/makenova/nodeginx/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248530609,"owners_count":21119601,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["nginx","nodejs"],"created_at":"2024-09-30T15:55:35.123Z","updated_at":"2025-04-13T08:11:35.615Z","avatar_url":"https://github.com/makenova.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nodeginx\n\nA helper library for managing [Nginx](https://www.nginx.com) virtual\nhost configs and the `nginx` process. This assumes you are using the\nsites-available and sites-enabled setup, where those directories are arranged as\nso,\n\n```\n/etc\n|-- nginx\n     |-- nginx.config\n     |-- sites-enabled\n     |    +-- site-two\n     +-- sites-available\n          |-- site-one\n          +-- site-two\n```\n\nserver blocks are setup in the sites-available directory and are \"turned on\"\nby creating a symbolic link to the sites-enabled directory. In the example\nabove, site-one and site-two are setup but only site-two is served by nginx.\n\n## Installation\n\nThis is a scoped [NPM](https://www.npmjs.com) package, [Node.js](https://nodejs.org/en/)\nis a prerequisite.\n\n```\n$ npm install -g @makenova/nodeginx\n```\n\n## Use\n\nThis can be used as a standalone module but was made to be used through [`nodeginx-cli`](https://github.com/makenova/nodeginx-cli).\n\n```\nvar nodeginx = require('@makenova/nodeginx')\n\nconst staticSiteObj = {\n  askAddSite: 'use static template',\n  tplPort: '80',\n  tplServerName: 'panda',\n  tplSiteRoot: '/home/user/panda'\n}\n\nnodeginx.addStaticSite(staticSiteObj, function (err, message) {\n  if (err) throw(err)\n  console.log(message) // =\u003e panda config file will be added to /etc/nginx/sites-available\n})\n```\n\n## API\n\n### `nodeginx.addStaticSite(siteObj, cb)`\n\nAdd a static site to the sites-available directory. The callback(`cb`) returns an error `err` and a `message`.\n\nThe siteObj should have the following properties:\n\n###### `siteObj.port`\n\nnubmer : 80 the port that the site should be served on\n\n###### `siteObj.serverName`\n\nstring : 'panda' the name of the site\n\n###### `siteObj.siteRoot`\n\nstring : '/home/user/panda' The absolute path to the site\n\n### `nodeginx.addProxySite(siteObj, cb)`\n\nAdd a proxy site to the sites-available directory. The callback(`cb`) returns an error `err` and a `message`.\n\nThe siteObj should have the following properties:\n\n###### `siteObj.port`\n\nnubmer : 80 the port that the site should be served on\n\n###### `siteObj.serverName`\n\nstring : 'panda' the name of the site\n\n###### `siteObj.proxyServerIp`\n\nstring : '127.0.0.1' The IP address of the server where the site is running\n\n###### `siteObj.proxyServerPort`\n\nstring : '8080' The port that the application is running on\n\n### `nodeginx.addSiteFromUserFile(siteObj, cb)`\n\nAdd a site from a users config file. The file will be copied to the `sites-available` directory.\n\n###### `siteObj.path`\n\nstring : '/home/user/panda' An absolute path to the config file\n\n### `nodeginx.removeSite(siteName, cb)`\n\nRemove a site from the sites-available directory. If the site is enabled i.e.\nhas a symbolic link in the sites-enabled directory, the symbolic link will be\nremoved first. The callback(`cb`) only returns an `err`.\n\n### `nodeginx.enableSite(siteName, cb)`\n\nEnable a site. All this does is create a symlink of a site in the\n`sites-available` directory to the `sites-enabled` directory.\n\n### `nodeginx.disableSite(siteName, cb)`\n\nDisable a site. Delete a symlink of a site from the `sites-enabled` directory.\n\n### `nodeginx.manageNginx(action, cb)`\n\nStart, stop, reload, etc. nginx\n\n### `nodeginx.constants`\n\nAn object with useful constants\n\n  * NGINX_PATH - the `nginx.conf` location, defaults to '/etc/nginx'\n  * sitesAvailableStr - the name of the `sites-available` directory\n  * sitesEnabledStr - the name of the `sites-enabled` directory\n\n## Bugs\nPlease report any bugs to: \u003chttps://github.com/makenova/nodeginx/issues\u003e\n\n## License\n\nLicensed under the MIT License: \u003chttps://opensource.org/licenses/MIT\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmakenova%2Fnodeginx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmakenova%2Fnodeginx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmakenova%2Fnodeginx/lists"}