{"id":23265695,"url":"https://github.com/pabloripoll/nginx-local-admin","last_synced_at":"2026-05-02T01:33:57.949Z","repository":{"id":171470876,"uuid":"647977121","full_name":"pabloripoll/nginx-local-admin","owner":"pabloripoll","description":"This program runs for Debian/Ubuntu for executing shortcuts to speed up domain management on local, VPS or Cloud servers with NGINX on port 80","archived":false,"fork":false,"pushed_at":"2023-06-08T11:12:39.000Z","size":67,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-12T12:56:57.224Z","etag":null,"topics":["apache","nginx","nginx-configuration","nginx-proxy"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pabloripoll.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":"support/dialogue.sh","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-01T00:06:29.000Z","updated_at":"2023-06-08T10:59:59.000Z","dependencies_parsed_at":null,"dependency_job_id":"da2efea2-e664-4b7b-a643-b62b5d34724f","html_url":"https://github.com/pabloripoll/nginx-local-admin","commit_stats":null,"previous_names":["pabloripoll/localadmin","pabloripoll/nginx-local-admin"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pabloripoll%2Fnginx-local-admin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pabloripoll%2Fnginx-local-admin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pabloripoll%2Fnginx-local-admin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pabloripoll%2Fnginx-local-admin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pabloripoll","download_url":"https://codeload.github.com/pabloripoll/nginx-local-admin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247450800,"owners_count":20940938,"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":["apache","nginx","nginx-configuration","nginx-proxy"],"created_at":"2024-12-19T15:31:37.476Z","updated_at":"2026-05-02T01:33:57.899Z","avatar_url":"https://github.com/pabloripoll.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Nginx Domains Admin\nThis program runs on **systemd** init systems installed in distros like Debian or Ubuntu consisting on an automation for managing domains basic settings on **LINUX OS** local machine, VPS or cloud server for deploying, listing or removing domains with much frequency in servers that primarly use **NGINX**, listening on port 80.\n\nThe **domain:create** wizard will ask for the basic configuration parameters to create a new server block but for practical usage, the edit will be manual.\nFor PHP projects gets the installed versions on system by its directory name found on `/etc/php` and depending on wich serve the domain is being created will automatically reverse proxy. \\\nIn the other hand, for other languages or Dockerized projects or directly served in other ports, like: NodeJS *(w/PM2)*, .NET or JAVA, it will create an server block for NGINX with reversed proxy to the desired port.\n\n## Why?\nThis program was developed to speed up common domain's actions when accomplishing all the steps to manage several testing apps turns into an anoyed job thus a waiste of time and focus. For this reason, I've taken the time to implement a **BASH** program for shortcuts support without complex software installation.\n\n## Minimum requirements\nLinux OS with Debian 8+ or Ubuntu 16+ \\\nNGINX on port:80 \\\nHave installed one of the supported languages.\n\n## Supported languages\nPHP \\\nGo \\\nNodeJS \\\nPython \\\nDotNet \\\nJava \\\nJava Springboot\n\n## Customization\nBy default the program alias uses the mnemotechnic name `localnet`. So, all the following command examples will use **localnet** as alias. But, if you want to use another alias, open `config/setting.sh` file and change it in the `ALIAS=\"otheralias\"` constant.\n\nAll Nginx dedicated server blocks can be adapted for your requirementes if are different to already set by editing the blocks in `block` directory.\n\nBefore start, **read `config/settings.sh` to know if any variable or constant must be updated**\n\n## Installation\nIt's recommended to install this program available only for one sudo user at `$HOME/bin` directory but if it need for all users, it can be installed on `/usr/local/bin` directory. Create the directory where this program is going to be placed. The following example will use:\n```\n$ mkdir -p $HOME/bin/localnet; sudo chown $USER:root $HOME/bin/localnet; cd $HOME/bin/localnet; chmod +x ./*;\n```\nThen, change directory to run the installation script\n```\n$ ./install.sh\n```\nOnce installed, refresh or open new terminal to run the admin commands as for e.g., listing Nginx registered domains with:\n```\n$ localnet domains\n```\n\n# Commands\n\n**· Listing registered domains:** \\\nList all domains registered by server plaform. \n```\n$ localnet domains\n```\nThat's the sames as:\n```\n$ localnet domains:index nginx\n```\n\nBy default will list **Nginx** domains but it will list **Apache** *(shortcut for: apache2)* if it was specified\n```\n$ localnet domains apache\n```\n\nCommand output will prompt something like the following example\n```\nDomains registered locally on NGINX server platform:\n[jun 01 17:43] [active] my.site.localhost.conf\n[may 03 22:53] [active] apitest.localhost.conf\n[ene 11 2022X] [record] example.localhost.conf\n```\nWhere `[record]` status is for domains that are listed on `site-available` but not on `site-enabled` directory. Thus, they cannot be visited by browsers.\n\nAlso there's a command to list both directories with their respective names `available` and `enabled`\n```\n$ localnet domains:available\n```\n```\n$ localnet domains:available apache\n```\n\n**· Update server domains:** \\\nOnce a domain is created or updated, server must be restarted. To do so, run\n```\n$ localnet domains:update\n```\nAbove command can be executed for Apache server as well.\n```\n$ localnet domains:update apache\n```\n\n**· Searching for a registered domain:** \\\nSearch for a domain on nginx server\n```\n$ localnet domains:like mydom\n```\nResult output\n```\nDomains registered on APACHE with name like: *mydom*\n[active] mydomain.localhost.conf\n[active] admin.mydomain.localhost.conf\n[record] demo.mydomain.localhost.conf\n[record] mydomain-old.localhost.conf\n```\nFor searching on Apache server the server must be specified\n```\n$ localnet domains:like apache mydom\n```\nResult output\n```\nDomains registered on APACHE with name like: *mydom*\n[active] mydomain.localhost.conf\n[active] admin.mydomain.localhost.conf\n[record] demo.mydomain.localhost.conf\n[record] mydomain-old.localhost.conf\n```\n\n**· Single root domain actions:** \\\nDefault top level domain is *.localhost* for is not necessary to add it when is used on local machine. For the following examples, *mydomain* will be used\n```\n$ localnet domain mydomain\n```\nBut if this program has been installed on a remote server, constant `TLD=\"\"` on `config/settings.sh` must be set empty to manage full root domain\n```\n$ localnet domain mydomain.com\n```\n**IMPORTANT!** **** Shouldn't be applied protocols **http:// https://**, neither subdomain **www.** ****\n\n**· Check domain info:** \\\nTo check out a domain existance and configuration\n```\n$ localnet domain mydomain\n```\nOutput will prompt as follows\n```\nDomain mydomain.localhost is recorded.\nDomain mydomain.localhost is running!\nDomain configuration:\nserver {\n        listen 80;\n        listen [::]:80;\n        root /var/www/nginx/mydomain;\n        index index.php index.html;\n        server_name mydomain.localhost www.mydomain.localhost;\n        location / {\n                try_files $uri $uri/ =404;\n        }\n        location ~ \\.php$ {\n                include snippets/fastcgi-php.conf;\n                fastcgi_pass unix:/run/php/php8.1-fpm.sock;\n        }\n}\n```\nFor domains registered on Apache platform it can be seen its configuration file too\n```\n$ localnet domain apache mydomain\n```\nOutput will be as follows\n```\nDomain: mydomain.localhost is recorded.\nDomain: mydomain.localhost is running!\nDomain configuration:\n\u003cVirtualHost *:8080\u003e\n    ServerName mydomain.localhost\n    ServerAlias www.mydomain.localhost\n    \n    DocumentRoot /var/www/apache/mydomain/\n\n    \u003cDirectory /var/www/apache/mydomain/\u003e\n        Options -Indexes +FollowSymLinks -MultiViews\n        AllowOverride All\n        Require all granted\n    \u003c/Directory\u003e\n\n    \u003cFilesMatch \\.php$\u003e\n        SetHandler \"proxy:unix:/var/run/php/php8.1-fpm.sock|fcgi://localhost\"\n    \u003c/FilesMatch\u003e \n\n    ErrorLog ${APACHE_LOG_DIR}/error.log\n    CustomLog ${APACHE_LOG_DIR}/access.log combined\n\u003c/VirtualHost\u003e\n```\n\n**· Check domain status:** \\\nTo check out a domain existance and configuration\n```\n$ localnet domain:status nginx mydomain\n```\nOutput will prompt as follows on a laravel app example\n```\nDomain mydomain.localhost set on NGINX platform status:\nHTTP/1.1 200 OK\nServer: nginx/1.18.0 (Ubuntu)\nDate: Mon, 05 Jun 2023 12:14:35 GMT\nContent-Type: text/html; charset=UTF-8\nConnection: keep-alive\nCache-Control: private, must-revalidate\npragma: no-cache\nexpires: -1\nSet-Cookie: XSRF-TOKEN=eyJpdiI6InhUcDR4eEtwYmRFcHVvUDJob0pROEE9PSIsInZhbHVlIjoiMjM4VkpIVkYzSG1sVmUzUlhwRWNUVkd4Y1pkL0pDVnpqcHlnYkQwY21HTHZsVmJZTFd3RzhiL0t5VXJmNTRtWkxkaVlBN09HMERxSXNFR0lrQW85OWJVSzhZeG9ZZE5RRmlOTTBMOXJLc2lVK25LU3VzYllrNDBTWVpaUThvNlciLCJtYWMiOiIwM2I5YjY0MWY0Njk3NzdiNjQwYWJiOGZjMTA2ODM0Zjc3NmNiNzA4M2RiMzU1MTZhMjg5YTMxMjM0OWE2NTZkIiwidGFnIjoiIn0%3D; expires=Mon, 05-Jun-2023 14:14:35 GMT; Max-Age=7200; path=/; samesite=lax\nSet-Cookie: mydomain_session=eyJpdiI6InVZQU1WUEhxSUhGUXp3TG1EL2ZkT0E9PSIsInZhbHVlIjoiWkMvL2FBcnc2VWwyQ3hYWHR0MFZsL2NsMU5ESGxBYWtHL3lXbUU0SytWR2NsS1lPZmpEM2paVEJxWlFmaDBZZGVRMTJPMzM1YmJwOEkrbjRkemlrK1l4aXRiS0JqbFNWRzhSL0diMHMvTXIxYlVaOFRXNjhhdHM1K1cxd2x2T2MiLCJtYWMiOiJhODg2YzkyODllMGE5OTNiNTEyOGFlYmI0ZWY0ZmJmMTc1NmEzOGRjOTNmMDdlNDgxOTM0Y2ExODQ4ZmE5ZjRlIiwidGFnIjoiIn0%3D; expires=Mon, 05-Jun-2023 14:14:35 GMT; Max-Age=7200; path=/; httponly; samesite=lax\n```\n\n**· Edit domain:** \\\nTo edit a Nginx domain server block there is two commands to performe it\n```\n$ localnet domain mydomain edit\n```\nor\n```\n$ localnet domain:edit mydomain\n```\nIt will open the server block to edit with nano\n```\nserver {\n        listen 80;\n        listen [::]:80;\n        root /var/www/nginx/mydomain;\n        index index.php index.html;\n        server_name mydomain.localhost www.mydomain.localhost;\n        location / {\n                try_files $uri $uri/ =404;\n        }\n        location ~ \\.php$ {\n                include snippets/fastcgi-php.conf;\n                fastcgi_pass unix:/run/php/php8.1-fpm.sock;\n        }\n}\n```\nAnd for domains registered on Apache\n```\n$ localnet domain apache mydomain edit\n```\nor\n```\n$ localnet domain:edit apache mydomain\n```\n\n**· Create domain:** \\\nCreate domain by server platform. To cancel process press \u003cCTRL\u003e + \u003cC\u003e keys.\n```\n$ localnet domain:create nginx mydomain\n```\nThe project directory in which the domain will match can be pre defined with common path set on `setting.sh` file \\\n*(\"??\" sets autocompleted default answer on empty value)* \\\nOnce completed the domain creator wizard, just continue pressing **y** or cancel using **n** \\\nNginx PHP output example:\n```\nComplete parameters followed by pressing \u003center\u003e key to set mydomain.localhost on NGINX server:\nEnter (y or n) if domain will use SSL ?? n: \nEnter the language will be applied from between options [php|nodejs|dotnet|java|pyton|c++|go]: php\nEnter index file ?? index.php: \nEnter the PHP version will be applied from options [8.1|7.4]: 8.1\nEnter the directory in which the domain will match from /var/www/nginx/:mydomain\n*** check configuration values before proceeding: ***\nDOMAIN: mydomain.localhost\nSERVER: Nginx\nSSL: false\nLANGUAGE: php\nVERSION: 8.1\nINDEX: index.php index.html\nDIRECTORY: /var/www/nginx/mydomain\nAre all the parameters correct? [y/n]:\n```\nApache PHP output example:\n```\nComplete parameters followed by pressing \u003center\u003e key to set mydomain.localhost on APACHE server:\nEnter (y or n) if domain will use SSL ?? n: \nEnter index file ?? index.php: \nEnter the PHP version will be applied from options [8.1|7.4]: 8.1\nEnter the directory in which the domain will match from /var/www/apache/:mydomain\n*** check configuration values before proceeding: ***\nDOMAIN: mydomain.localhost\nSERVER: Nginx\nProxy: APACHE on port :8080\nSSL: false\nLANGUAGE: php\nVERSION: 8.1\nINDEX: index.php index.html\nDIRECTORY: /var/www/apache/mydomain\nAre all the parameters correct? [y/n]:\n```\nNginx other language output example:\n```\nComplete parameters followed by pressing \u003center\u003e key to set mydomain.localhost on NGINX server:\nEnter (y or n) if domain will use SSL ?? n: \nEnter the language will be applied from between options [php|nodejs|dotnet|java|pyton|c++|go]: go\nEnter index file ?? index.html: main.go\nTo prevent a listener overlap, you`d have to be sure the port to use: $ sudo ss -tulwn | grep LISTEN\nEnter the port will be reversed proxy to: 5000\nEnter the directory in which the domain will match from /var/www/golang/:mydomain\n*** check configuration values before proceeding: ***\nDOMAIN: mydomain.localhost\nSERVER: Nginx\nProxy: GO on port :5000\nSSL: false\nLANGUAGE: go\nINDEX: main.go\nDIRECTORY: /var/www/golang/mydomain\nAre all the parameters correct? [y/n]:\n```\n\n**· Put up domain:** \\\nTo put a domain up online in Nginx\n```\n$ localnet domain:up mydomain\n```\nOutput may ask your sudo user password\n```\nDomain mydomain.localhost access through NGINX platform will be put up online.\nAre you sure to proceed? [y/n]: y\nDomain mydomain.localhost has been put up online in NGINX platform.\nNGINX sites has been updated!\n```\n\nAnd for putting a domain up online in Apache\n```\n$ localnet domain:up apache mydomain\n```\nOutput\n```\nDomain mydomain.localhost access through APACHE platform will be put up online.\nAre you sure to proceed? [y/n]: y\nDomain mydomain.localhost has been put up online in APACHE platform.\nAPACHE sites has been updated!\nDomain mydomain.localhost has been put up online in NGINX platform.\nNGINX sites has been updated!\n```\n\n**· Put down domain:** \\\nTo put a domain down offline in Nginx\n```\n$ localnet domain:down mydomain\n```\nOutput may ask your sudo user password\n```\nDomain mydomain.localhost access through APACHE platform will be put down offline.\nAre you sure to proceed? [y/n]: y\n[sudo] password for \"user\":\nDomain mydomain.localhost has been put down offline in APACHE platform.\nAPACHE sites has been updated!\nDomain mydomain.localhost has been put down offline in NGINX platform.\nNGINX sites has been updated!\n```\n\nAnd for puttin a domain down offline in Apache\n```\n$ localnet domain:down apache mydomain\n```\nOutput\n```\nDomain mydomain.localhost access through APACHE platform will be put down offline.\nAre you sure to proceed? [y/n]: y\n[sudo] password for \"user\":\nDomain mydomain.localhost has been put down offline in APACHE platform.\nAPACHE sites has been updated!\nDomain mydomain.localhost has been put down offline in NGINX platform.\nNGINX sites has been updated!\n```\n\n**· Remove domain from register:** \\\nTo remove of a domain registered on Nginx\n```\n$ localnet domain:remove mydomain\n```\nOutput\n```\nWarning! domain mydomain.localhost accessed through NGINX platform will be remove.\nAre you sure to proceed? [y/n]: y\n[sudo] password for user:\nDomain mydomain.localhost has been remove of NGINX platform.\nNGINX sites has been updated!\n```\n\nAnd for Apache will automatically sincronized will Nginx. So, it will just require to run\n```\n$ localnet domain:remove apache mydomain\n```\nOutput\n```\nWarning! domain mydomain.localhost accessed through APACHE platform will be remove.\nAre you sure to proceed? [y/n]: y\n[sudo] password for user:\nDomain mydomain.localhost has been remove of APACHE platform.\nAPACHE sites has been updated!\nDomain mydomain.localhost has been remove of NGINX platform.\nNGINX sites has been updated!\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpabloripoll%2Fnginx-local-admin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpabloripoll%2Fnginx-local-admin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpabloripoll%2Fnginx-local-admin/lists"}