thay dỏi cong
This commit is contained in:
+29
-6
@@ -49,6 +49,29 @@ webrtcAdditionalHosts:
|
||||
- 192.168.88.10
|
||||
```
|
||||
|
||||
### 2.1) Nếu MediaMTX API bị 401 Unauthorized
|
||||
|
||||
401 nghĩa là request thiếu thông tin xác thực hợp lệ. Khi bật auth trong MediaMTX, bạn cần tạo user có quyền `api` và cấu hình backend dashboard gửi Basic Auth.
|
||||
|
||||
Ví dụ trong `mediamtx.yml`:
|
||||
|
||||
```yaml
|
||||
authMethod: internal
|
||||
authInternalUsers:
|
||||
- user: dashboard
|
||||
pass: dashboard_password
|
||||
ips: ['127.0.0.1', '::1', '192.168.88.0/24']
|
||||
permissions:
|
||||
- action: api
|
||||
```
|
||||
|
||||
Sau đó trên máy chạy dashboard backend:
|
||||
|
||||
```bash
|
||||
export MEDIAMTX_API_USER="dashboard"
|
||||
export MEDIAMTX_API_PASS="dashboard_password"
|
||||
```
|
||||
|
||||
Trong `paths`, bạn có thể để dashboard tự thêm path bằng API (Settings → Add Camera).
|
||||
|
||||
Tạo thư mục recordings:
|
||||
@@ -144,7 +167,7 @@ export MEDIAMTX_API_PASS="..."
|
||||
|
||||
```bash
|
||||
source api/.venv/bin/activate
|
||||
uvicorn api.app.main:app --host 0.0.0.0 --port 8000
|
||||
uvicorn api.app.main:app --host 0.0.0.0 --port 8008
|
||||
```
|
||||
|
||||
## 4) Frontend (build static)
|
||||
@@ -163,7 +186,7 @@ Output nằm ở `dist/`.
|
||||
|
||||
Có 2 cách phổ biến:
|
||||
|
||||
1) Nginx serve `dist/` và reverse proxy `/api` + `/videos` về backend `:8000`
|
||||
1) Nginx serve `dist/` và reverse proxy `/api` + `/videos` về backend `:8008`
|
||||
2) Dùng Caddy tương tự
|
||||
|
||||
Ví dụ Nginx server block tối thiểu:
|
||||
@@ -181,11 +204,11 @@ server {
|
||||
}
|
||||
|
||||
location /api/ {
|
||||
proxy_pass http://127.0.0.1:8000;
|
||||
proxy_pass http://127.0.0.1:8008;
|
||||
}
|
||||
|
||||
location /videos/ {
|
||||
proxy_pass http://127.0.0.1:8000;
|
||||
proxy_pass http://127.0.0.1:8008;
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -207,7 +230,7 @@ After=network.target
|
||||
WorkingDirectory=/opt/ipcam-dashboard
|
||||
Environment=MEDIAMTX_API_USER=
|
||||
Environment=MEDIAMTX_API_PASS=
|
||||
ExecStart=/opt/ipcam-dashboard/api/.venv/bin/uvicorn api.app.main:app --host 0.0.0.0 --port 8000
|
||||
ExecStart=/opt/ipcam-dashboard/api/.venv/bin/uvicorn api.app.main:app --host 0.0.0.0 --port 8008
|
||||
Restart=always
|
||||
RestartSec=2
|
||||
|
||||
@@ -225,7 +248,7 @@ sudo systemctl status ipcam-dashboard
|
||||
|
||||
## 6) Kiểm tra nhanh
|
||||
|
||||
- Backend: `curl http://localhost:8000/api/health`
|
||||
- Backend: `curl http://localhost:8008/api/health`
|
||||
- MediaMTX API: `curl http://localhost:9997/v3/paths/list`
|
||||
- Frontend: mở `http://<orange-pi-ip>/`
|
||||
|
||||
|
||||
Reference in New Issue
Block a user