{"id":21696654,"url":"https://github.com/patrickcurl/ngtool","last_synced_at":"2025-04-12T12:11:21.091Z","repository":{"id":152635535,"uuid":"78373495","full_name":"patrickcurl/ngtool","owner":"patrickcurl","description":"NG Tool is Bash Script to allow create,  delete, enable all, disable all, enable single or disable single vhosts for nginx virtual hosts on linux in a quick way.","archived":false,"fork":false,"pushed_at":"2023-12-15T16:38:57.000Z","size":21,"stargazers_count":13,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-26T06:51:10.603Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Shell","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/patrickcurl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2017-01-08T22:06:03.000Z","updated_at":"2023-12-15T16:39:01.000Z","dependencies_parsed_at":null,"dependency_job_id":"5fbddd1c-b051-4120-8d22-d8a538c39786","html_url":"https://github.com/patrickcurl/ngtool","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrickcurl%2Fngtool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrickcurl%2Fngtool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrickcurl%2Fngtool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrickcurl%2Fngtool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/patrickcurl","download_url":"https://codeload.github.com/patrickcurl/ngtool/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248565074,"owners_count":21125417,"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":[],"created_at":"2024-11-25T19:21:08.208Z","updated_at":"2025-04-12T12:11:21.071Z","avatar_url":"https://github.com/patrickcurl.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"Support Me by going to my Etsy store : http://myjarofhope.etsy.com\n===========\nBash Script to allow create or delete nginx virtual hosts on linux in a quick way.\n\n## Installation ##\n\n```shell\n$ mkdir ~/bin \u0026\u0026 cd ~/bin \n$ git clone  https://github.com/patrickcurl/ngtool\n$ cd ngtool \u0026\u0026 chmod +x ng\n$ sudo ln -s /home/username/bin/ngtool/ng /usr/local/bin/ng\n```\n\nAlternately you can add the ngtool directory to your $PATH, it just needs to be in a folder that's in the $PATH. \n\nI also recommend adding an alias to ~/.bash_rc or ~/.bash_aliases : alias ng=\"sudo ng\"\n\nThe script requires being run as sudo, or else you can't modify nginx files - this way it'll do so by default, and you \nstill need to enter a password.\n\n## Caveat Emptor on .dev domains and HSTS ## \n\n'.dev' domains are blocked from browsers now because  of HSTS (blame google), I highly recommend only using '.test'. \n\nOn my system what I've done is enabled a global dns wildcard using dnsmasq, this makes it so all .test domains are local and need no editing. \n\nI'm on ARCH linux so YMMV, but to do this I added a file named test.tld in /etc/NetworkManager/dnsmasq.d with the following contents:\n\n```\nlocal=/test/\naddress=/test/127.0.0.1\nlisten-address=127.0.0.1\n```\n\nThen run: \n```shell\n$ sudo systemctl restart NetworkManager\n$ ping anything.test\n```\n\nYou'll need to wait for the Network Manager to start back up in a few seconds before running the ping, but any domain should now resolve locally without editing hosts file.\n\nNow you can edit the useHosts config in the NG tool to false as you won't need to edit hosts.\n \n\n## Config ##\n```bash\n### CONFIG SETTINGS\n# Put owner/group that nginx must run under for your system.\n# The default on ubuntu would be user: www-data group: www-data.\n# This is my personal settings for Arch linux.\n\n#owner for chowing -- this is the owner nginx uses.\nowner=patrick \n\n#group for chowing -- this is the group nginx uses.\ngroup=users \n\n#sites-enabled path\nsitesEnabled='/etc/nginx/sites-enabled/' \n\n#sites-available path\nsitesAvailable='/etc/nginx/sites-available/' \n\n#make true if you do not have a global .test wildcard setup via dnsmasq or other.\nuseHosts=false \n\n#whether to use, setup and regenerate self-signed wildcard ssl. \nuseSSL=true \n\n# SSL Settings only matter if useSSL is true.\nsslConfig='/etc/nginx/ssl/ssl_servers.cfg'\nsslKey='/etc/nginx/ssl/nginx.key'\nsslCert='/etc/nginx/ssl/nginx.crt'\n\n# Change this to match what your system uses.\n#arch\nrestart='systemctl restart nginx'\n\n#ubuntu\n# restart=service nginx restart\n\n### END CONFIG SETTINGS\n```\n\n## Usage ##\n\nBasic command line syntax:\n\n```bash\n$ ng [create | delete | enable | disable] [domain] [/full/path/to/project/dir]\n```\n\n### Examples ###\n\nTo create a new virtual host:\n\n```bash\n$ ng create mysite.test /home/patrick/projects/laravel/mysite/public\n```\nTo delete a virtual host\n\n```bash\n$ ng delete mysite.dev\n```\n\nTo enable ALL virtual hosts: \n\n```bash\n$ ng enable\n```\n\nTo enable a single virtual host:\n\n```bash\n$ ng enable vhost.test\n```\nTo disable all hosts: \n\n```bash\n$ ng disable all\n```\n\nTo disable a single host: \n\n```bash\n$ ng disable vhost.test\n```\n\n## License ##\nMIT : Basically do whatever just provide copyright notice w/ all derivatives. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatrickcurl%2Fngtool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpatrickcurl%2Fngtool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatrickcurl%2Fngtool/lists"}