{"id":16441536,"url":"https://github.com/karakanb/nginx-subdomain-generator-script","last_synced_at":"2025-10-26T05:07:17.380Z","repository":{"id":83635081,"uuid":"58774923","full_name":"karakanb/nginx-subdomain-generator-script","owner":"karakanb","description":"A bash script that is creating subdomain with given parameters with Nginx in the directory /var/www","archived":false,"fork":false,"pushed_at":"2017-05-05T12:28:20.000Z","size":5,"stargazers_count":14,"open_issues_count":0,"forks_count":11,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-18T19:18:41.371Z","etag":null,"topics":["bash","bash-script","nginx","nginx-configuration","nginx-proxy","nginx-server","server-block","subdomain"],"latest_commit_sha":null,"homepage":null,"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/karakanb.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":"2016-05-13T21:59:39.000Z","updated_at":"2024-03-19T20:44:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"f50289e7-a98e-4ffc-a696-2f94fc84fb93","html_url":"https://github.com/karakanb/nginx-subdomain-generator-script","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/karakanb%2Fnginx-subdomain-generator-script","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karakanb%2Fnginx-subdomain-generator-script/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karakanb%2Fnginx-subdomain-generator-script/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karakanb%2Fnginx-subdomain-generator-script/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/karakanb","download_url":"https://codeload.github.com/karakanb/nginx-subdomain-generator-script/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245078067,"owners_count":20557274,"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":["bash","bash-script","nginx","nginx-configuration","nginx-proxy","nginx-server","server-block","subdomain"],"created_at":"2024-10-11T09:14:46.058Z","updated_at":"2025-10-26T05:07:12.349Z","avatar_url":"https://github.com/karakanb.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nginx-subdomain-generator-script\nA bash script that is creating subdomain with given parameters with Nginx in the directory ```/var/www```.\nThe original script and a tutorial on how to manually create server blocks can be found in here:\n\nhttp://clubmate.fi/how-to-make-an-nginx-server-block-manually-or-with-a-shell-script/\n\nI updated and modified the code in order to use it for adding subdomains to an existing system by using Nginx server blocks. \n\n## Usage\n\nDownload the file using `wget`:\n```bash\n# Download the file and save as SubdomainGenerator.sh\nwget -O SubdomainGenerator.sh https://raw.githubusercontent.com/karakanb/nginx-subdomain-generator-script/master/SubdomainGenerator.sh\n\n# Change mode of the script to executable.\nchmod +x SubdomainGenerator.sh\n\n# Run the script with the subdomain and the parent domain as the parameters.\nsudo ./SubdomainGenerator.sh foo example.com\n\n```\n\nThis will generate a subdomain as ```foo.example.com```. Don't forget to create the subdomain from your DNS provider to point the same IP address of the server itself, this is out of Nginx's scope.\n\nIt uses standard Nginx config files, and creates the files to be served under the folder `/var/www` with the structure as `/var/www/foo/public_html`, or `/var/www/mySubDomain/public_html`. The choice of folder where to create the serving files can be edited with the `$WEB_DIR` variable in the beginning of the program. \n\nFor the sake of simplicity, a more basic syntax may be created with `alias GenerateSubdomain='sudo ./SubdomainGenerator.sh'`, which allows you to call the command as `GenerateSubdomain mysubdomain mymaindomain.com`. \n\n--------\n\n## License\nThis script is licensed under the MIT License.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkarakanb%2Fnginx-subdomain-generator-script","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkarakanb%2Fnginx-subdomain-generator-script","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkarakanb%2Fnginx-subdomain-generator-script/lists"}