{"id":28196930,"url":"https://github.com/markc/hcp_php84","last_synced_at":"2025-05-16T16:14:14.011Z","repository":{"id":274618847,"uuid":"923421215","full_name":"markc/hcp_php84","owner":"markc","description":"A super lightweight Hosting Control Panel using PHP 8.4+","archived":false,"fork":false,"pushed_at":"2025-02-05T07:49:17.000Z","size":306,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-19T12:40:22.208Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/markc.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,"zenodo":null}},"created_at":"2025-01-28T07:59:22.000Z","updated_at":"2025-04-18T09:14:43.000Z","dependencies_parsed_at":"2025-01-28T12:26:53.689Z","dependency_job_id":"13f73db6-f4c3-4dee-b615-e92bcf7a0a45","html_url":"https://github.com/markc/hcp_php84","commit_stats":null,"previous_names":["markc/hcp"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markc%2Fhcp_php84","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markc%2Fhcp_php84/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markc%2Fhcp_php84/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markc%2Fhcp_php84/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/markc","download_url":"https://codeload.github.com/markc/hcp_php84/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254564074,"owners_count":22092124,"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":"2025-05-16T16:14:12.660Z","updated_at":"2025-05-16T16:14:14.001Z","avatar_url":"https://github.com/markc.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NetServa HCP (RC1)\n\nThis is an ultra simple PHP based **Hosting Control Panel** for a lightweight\nMail, Web and DNS server on an uptodate Ubuntu Server. It depends on the\n[NetServa SH] shell scripts being installed first.\n\n## Hosting Control Panel\n\nThis project is ideal for [LXD containers] or cheap 256MB to 512MB VPS plans.\n\n- [NetServa SH/HCP] does not reqire Python or Ruby, just PHP and Bash\n- Fully functional IMAP/SMTP mailserver with personalised Spam filtering\n- [LetsEncrypt] SSL enabled [nginx] web server with [PHP FPM 7+]\n- Optional [PowerDNS] installation for local LAN or real-world DNS service\n- Always based and tested on the latest release of [Ubuntu Server]\n- It can use either [SQLite] or [MySQL] as database backends\n- A fresh SQLite based install uses about 70MB ram (without Wordpress)\n- The \"compiled\" single file PHP script is less than 200KB in size\n- Built from the ground up using [Bootstrap 4] and [DataTables]\n- Developed and tested using LXD containers on the latest [Plasma Desktop]\n\n## Usage\n\nThe PHP web interface relies on the [NetServa SH] scripts being installed\non the primary and target hosts so the first thing to do, as root...\n\n    wget https://raw.githubusercontent.com/netserva/sh/master/bin/setup-sh ; . setup-sh\n\n_Please first review the very simple script with \"cat setup-sh\"._\n\nThis installs the `SH` (Shell Helper) aliases and scripts into a `/root/.sh`\ndirectory and activates the environment variables and special aliases. See\nthe [NetServa SH] repo for more information about how to use these aliases\nand scripts directly. This `HCP` project is just a web based frontend for\nthe `SH` system which does all the real provisioning and management work.\n\nThe first step, after installing the `SH` scripts, is to make sure the\ncurrent host has a hostname and a domainname. The domainname needs to be\nvalid if using a publically accessible server and that needs the assistence\nof a real DNS service. Otherwise, if using a local LAN with private IPs\n(like 192.168.\\*, 10.\\* or 172.\\*) then you can make up any domainname as\nlong as your are consistent within your local LAN. Using something like\n`netserva.lan` is a good candidate unless you prefer something else. The\nhostname of your current host computer is usually determined when the OS is\ninstalled but can be changed by editing `/etc/hostname` and making sure\n`/etc/resolv.conf` has a reference like `search netserva.lan`. Once you get\nresults like this...\n\n    ~ hostname\n    myhost\n    ~ hostname -d\n    netserva.lan\n    ~ hostname -f\n    myhost.netserva.lan\n\n(where `myhost` and `netserva.lan` are your real or made up names) then\ncontinue on with the next step.\n\nNow we \"normalize\" the host by using `setup-host` which updates the primary\nhosting **Desktop** or **Server** system to Bionic 18.04 (unless `os release`\nis defined.) using the current `hostname -f` unless a **hostname.domainname**\nis passed in as the first `[domain]` argument...\n\n    Usage: setup-host [domain] [(mysql)|sqlite] [admin(sysadm)] [os release(bionic)] [os mirror(archive.ubuntu.com)]\n\nAssuming a LXD container is to be used for the actual server side\n(recommended for initial testing anyway) then use `setup-lxd` to install\nand setup the basic LXD container system...\n\n    Usage: setup-lxd [pool size (25) GB] [passwd] [IP]\n\nWe can now setup the actual NetServa SH/HCP system for testing so, for\nexample, if we use something like `c1.netserva.lan`,\nwhere `c1` will be the container label and `netserva.lan` can either be a\nreal domainname (if the server has a public IP) or whatever internal\nLAN-wide domainname you care to use...\n\n    Usage: newlxd FQDN [(small)|medium|large] [distro(bionic)] [(mysql)|sqlite]\n\nIf the installation procedure can detect an externally available public IP\nthen it will attempt to install a LetsEncrypt SSL certificate so that the\nweb server can be accessed via `https` and the mail server will be SSL enabled\nand ready for real-world deployment. Otherwise a self-signed certificate will\nbe installed (which can be a problem for Firefox.) The mail, web, sftp and HCP\nlogin credentials will be available in `cat ~/.vhosts/$(hostname -f).conf`.\n\nThe essential configuration settings for the default server will be inside\nthe container (example only for a local LAN domain called `netserva.lan`)...\n\n    lxc exec c1 bash\n    cat ~/.vhosts/$(hostname -f)\n\nOr, if you already have a containter or remote server ready to use after a\nfresh Ubuntu install then you could install the entire NetServa SH and HCP\nsystem by ssh'ing into the system (or for example, \"lxc exec c1 bash\" for a\nlocal LXD container) and...\n\n    wget https://raw.githubusercontent.com/netserva/sh/master/bin/setup-sh\n    # cat setup-sh\n    . setup-sh\n    setup-all\n\nThis may take 5 to 15 mintes to complete depending on the bandwidth\navailable to the target server. Once finished you should be able to go to\n`https://c1.netserva.lan/hcp` and login to the HCP web interface using the\nsimple sitewide HTTP `sysadm/1234` authentication first then the real admin\nusername and password available with `cat ~/.vhosts/$(hostname -f).conf`.\n\n## Config Override\n\nThe main `index.php` file is actually the configuration for the entire\nprogram so that the rest of the PHP files could actually be included from\nanywhere else on the system (not just from `lib/php`) if the `INC` const\nis changed. To override the default settings (so sensitive information is\nnot committed to some Git repo) a config override file can be put anywhere\n(the default being `lib/.ht_conf.php`) in which an array is returned where\nany of the top level property array values can be overridden. First review\nthe main [index.php] file top level properties then compare below as an\nexample of how to override these property values...\n\n    \u003c?php\n    return [\n        'cfg' =\u003e ['email' =\u003e 'YOUR@EMAIL_ADDRESS'],\n        'db' =\u003e ['type' =\u003e 'mysql', 'pass' =\u003e 'YOUR_MYSQL_PW'],\n        'out' =\u003e [\n            'doc'   =\u003e 'YOUR_SITE_LABEL',\n            'head'  =\u003e 'YOUR_SITE_LABEL',\n            'foot'  =\u003e 'Copyright (C) 2018 YOUR_SITE_LABEL',\n        ],\n    ];\n\nwhich would change the default email address (for forgotten password etc)\nto your email address, set the database to use MySQL with it's password\nand change the site titles and footer copyright notice. The SH/HCP system\nwill use MySQL by default so if you use...\n\n    setup-all $(hostname -f) sqlite\n\nfor an extremely lightweight system (minus Wordpress) then use a\n`lib/.ht_conf.php` override file like...\n\n    \u003c?php\n    return [\n        'cfg' =\u003e ['email' =\u003e 'YOUR@EMAIL_ADDRESS'],\n        'db' =\u003e ['type' =\u003e 'sqlite'],\n        'out' =\u003e [\n            'doc'   =\u003e 'YOUR_SITE_LABEL',\n            'head'  =\u003e 'YOUR_SITE_LABEL',\n            'foot'  =\u003e 'Copyright (C) 2018 YOUR_SITE_LABEL',\n        ],\n    ];\n\nAnother alternate option for a MySQL password is to create a simple plain\ntext file called `lib/.ht_pw` and put ONLY the MySQL password in that file\nbut of course using `lib/.ht_conf.php` instead allows you to modify or\nextend any of the top level properties in `index.php`.\n\nThe point of the config override is so you can keep doing a `git pull`and\nupdate the HCP web area (either from the NetServa repo or your own fork)\nwithout interference from locally updated files, and `git push` (to your\nown git repo) will not upload passwords to a possible public git repo.\n\n## Athentication\n\nDuring installation five random passwords will be auto-created in\n`/root/.vhosts/$(hostname -f)` along with a `/root/.my.cnf` with `DPASS`\nif MySQL is being used. Example...\n\n    ~ grep PASS ~/.vhosts/$(hostname -f)\n    APASS='LheTZOT8eYCrlAk8'  # Admin HCP password\n    DPASS='axVps7OIXb7VY4uT'  # Database password, if using MySQL\n    EPASS='a5cBBxXL59uAyJkc'  # SMTP/IMAP password for admin@$VHOST\n    UPASS='D8G3RgpBgSetyG4o'  # SFTP password\n    WPASS='LheTZOT8eYCrlAk8'  # Wordpress admin password, if using MySQL\n\nThe initial `sysadm` user has access to most of the server with SUDO\npermissions to the provisioning scripts in `/root/.sh/bin/*`. This user\nalso \"owns\" the default `YOUR_DOMAIN/adm` web area with the NetServa HCP\nweb interface. All extra virtual hosts will be owned by `u1000 u1001 u1002\netc` system users which will be chrooted, or locked into, their respective\nVHOST web area. For instance...\n\n    ~ shhost all\n    sysadm  c1.netserva.org                          /home/u/c1.netserva.org\n    u1001   netserva.org                             /home/u/netserva.org\n    u1002   netserva.com                             /home/u/netserva.com\n    u1003   netserva.net                             /home/u/netserva.net\n\nwhere the above resulted from...\n\n    ~ newlxd c1.netserva.org\n    # then SSH/exec into the container and...\n    ~ addvhost netserva.org\n    ~ addvhost netserva.com\n    ~ addvhost netserva.net\n\nThe authentication point being that using SSH or SFTP (ie; from Dolphin) to\nthis server as...\n\n    ~ ssh -p9 sysadm@netserva.org\n    # or for KDE kio\n    sftp://sysadm@netserva.org:9/\n\nwould result in access to the whole (non-root) file system whereas...\n\n    ~ ssh -p9 u1001@netserva.org\n    # or for KDE kio\n    sftp://u1001@netserva.org:9/\n\nwould chroot or lock access to the `/home/u/netserva.org` area with no\npossibility of using SUDO so folks only interested in working on a web site\nhave reasonably safe access to only that web area.\n\n`setup-ssh` can be used on the host to manage local SSH keys making logging\nin to a container or remote server much easier...\n\n    Usage: setup-ssh domain [targethost] [user] [port] [sshkeyname]\n\n_All scripts and documentation are Copyright (C) 1995-2018 Mark Constable\nand Licensed [AGPL-3.0]_\n\n[NetServa SH]: https://github.com/netserva/sh/\n[NetServa SH/HCP]: https://github.com/netserva/\n[AGPL-3.0]: http://www.gnu.org/licenses/agpl-3.0.html\n[Bootstrap 4]: https://getbootstrap.com/\n[DataTables]: https://datatables.net/examples/styling/bootstrap4/\n[index.php]: https://github.com/netserva/www/blob/master/index.php\n[nginx]: http://nginx.org/\n[PHP FPM 7+]: http://www.php.net/manual/en/install.fpm.php\n[Plasma Desktop]: https://kubuntu.org/\n[LXD containers]: https://linuxcontainers.org/lxd/introduction/\n[LetsEncrypt]: https://letsencrypt.org/\n[PowerDNS]: https://powerdns.com/\n[SQLite]: https://sqlite.org/features.html\n[MySQL]: https://mariadb.org/\n[Ubuntu Server]: https://ubuntu.com/download/server/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkc%2Fhcp_php84","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarkc%2Fhcp_php84","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkc%2Fhcp_php84/lists"}