instruvtcion to route 8000 to 80 via apache

This commit is contained in:
2026-09-24 13:27:08 +05:00
parent d5b5819ba0
commit 537f455e10
+28
View File
@@ -72,6 +72,26 @@ journalctl -u jsonnutserver.service -f
curl 'http://localhost:8000/jsonstatus?=nutdev1@localhost'
```
## Serve through Apache (optional)
To expose `/jsonstatus` on an existing Apache site, proxy it to the local server.
Consider setting `LISTEN_HOST=127.0.0.1` (see above) so port 8000 is only
reachable through Apache.
```bash
sudo a2enmod proxy proxy_http
sudo tee /etc/apache2/conf-available/nut-json.conf > /dev/null <<'EOF'
ProxyPass /jsonstatus http://127.0.0.1:8000/jsonstatus
ProxyPassReverse /jsonstatus http://127.0.0.1:8000/jsonstatus
EOF
sudo a2enconf nut-json
sudo apachectl configtest && sudo systemctl restart apache2
```
```bash
curl 'http://localhost/jsonstatus?=nutdev1@localhost'
```
## Update
```bash
@@ -90,3 +110,11 @@ sudo rm /etc/systemd/system/jsonnutserver.service
sudo systemctl daemon-reload
sudo rm -r /opt/jsonnutserver
```
If you set up the Apache proxy:
```bash
sudo a2disconf nut-json
sudo rm /etc/apache2/conf-available/nut-json.conf
sudo systemctl reload apache2
```