chore: add readme
This commit is contained in:
@@ -0,0 +1,105 @@
|
||||
# Kratos (PHP Wake-on-LAN)
|
||||
|
||||
A simple PHP web app to wake configured machines on your network.
|
||||
|
||||
## Requirements
|
||||
|
||||
- Linux server
|
||||
- PHP 7.4+ (PHP 8.x also works)
|
||||
- A web server (Apache or Nginx) or PHP built-in server for local use
|
||||
- `wakeonlan` command installed on the server
|
||||
- `ping` command available on the server
|
||||
|
||||
Install dependencies on Debian/Ubuntu:
|
||||
|
||||
```bash
|
||||
sudo apt update
|
||||
sudo apt install -y php php-cli wakeonlan iputils-ping
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
1. Copy this project to your server.
|
||||
2. Edit `hosts.php` and set your own hosts:
|
||||
- `mac_address`: device MAC address
|
||||
- `ip_address`: device IP address
|
||||
- `friendly_name`: name shown in the UI
|
||||
|
||||
## Run locally (quick test)
|
||||
|
||||
From the project directory:
|
||||
|
||||
```bash
|
||||
php -S 0.0.0.0:8080
|
||||
```
|
||||
|
||||
Then open:
|
||||
|
||||
- `http://<server-ip>:8080/`
|
||||
|
||||
## Deploy as a PHP application
|
||||
|
||||
### Option 1: Apache
|
||||
|
||||
1. Put this project in your web root (example: `/var/www/kratos`).
|
||||
2. Ensure Apache and PHP are installed.
|
||||
3. Create a vhost pointing `DocumentRoot` to the project folder.
|
||||
4. Enable the site and reload Apache.
|
||||
|
||||
Example minimal Apache vhost:
|
||||
|
||||
```apache
|
||||
<VirtualHost *:80>
|
||||
ServerName kratos.local
|
||||
DocumentRoot /var/www/kratos
|
||||
|
||||
<Directory /var/www/kratos>
|
||||
AllowOverride All
|
||||
Require all granted
|
||||
</Directory>
|
||||
|
||||
ErrorLog ${APACHE_LOG_DIR}/kratos_error.log
|
||||
CustomLog ${APACHE_LOG_DIR}/kratos_access.log combined
|
||||
</VirtualHost>
|
||||
```
|
||||
|
||||
Enable and reload:
|
||||
|
||||
```bash
|
||||
sudo a2ensite kratos.conf
|
||||
sudo systemctl reload apache2
|
||||
```
|
||||
|
||||
### Option 2: Nginx + PHP-FPM
|
||||
|
||||
1. Put this project in `/var/www/kratos`.
|
||||
2. Install `nginx` and `php-fpm`.
|
||||
3. Create an Nginx server block and point it to the project root.
|
||||
4. Reload Nginx.
|
||||
|
||||
Example minimal Nginx config:
|
||||
|
||||
```nginx
|
||||
server {
|
||||
listen 80;
|
||||
server_name kratos.local;
|
||||
|
||||
root /var/www/kratos;
|
||||
index index.php;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.php?$query_string;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
include snippets/fastcgi-php.conf;
|
||||
fastcgi_pass unix:/run/php/php-fpm.sock;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Notes
|
||||
|
||||
- The web server user must be allowed to run `wakeonlan` and `ping`.
|
||||
- If status checks always fail, verify firewall rules and ICMP availability.
|
||||
- Keep this app on your trusted local network or behind authentication/VPN.
|
||||
Reference in New Issue
Block a user