forked from urvishpatelce/lxd-app
Refactor code
This commit is contained in:
@ -35,9 +35,6 @@ backend/
|
||||
└── README.md
|
||||
|
||||
|
||||
---
|
||||
|
||||
|
||||
---
|
||||
|
||||
## ⚙️ Requirements
|
||||
@ -46,9 +43,10 @@ backend/
|
||||
- LXD installed and configured
|
||||
- PHP-FPM + NGINX
|
||||
- Composer
|
||||
- `guzzlehttp/guzzle`
|
||||
- `slim/slim`
|
||||
- `slim/psr7`
|
||||
- `guzzlehttp/guzzle`
|
||||
- `vlucas/phpdotenv`
|
||||
|
||||
---
|
||||
|
||||
@ -57,41 +55,41 @@ backend/
|
||||
1. **put the folder in /var/www/html**
|
||||
|
||||
2. **Install dependencies**
|
||||
|
||||
```bash
|
||||
composer install
|
||||
|
||||
|
||||
3. **Ensure PHP and NGINX are configured**
|
||||
|
||||
NGINX config example:
|
||||
```bash
|
||||
server {
|
||||
listen 80;
|
||||
server_name *.lxdapp.local;
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name *.lxdapp.local;
|
||||
root /var/www/html/lxd-app/backend/public;
|
||||
index index.php;
|
||||
|
||||
root /var/www/html/lxd-app/backend/public;
|
||||
index index.php;
|
||||
location / {
|
||||
try_files $uri /index.php?$query_string;
|
||||
}
|
||||
|
||||
location / {
|
||||
try_files $uri /index.php?$query_string;
|
||||
location ~ \.php$ {
|
||||
fastcgi_pass unix:/run/php/php8.4-fpm.sock;
|
||||
fastcgi_index index.php;
|
||||
include fastcgi_params;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
fastcgi_read_timeout 300;
|
||||
}
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
fastcgi_pass unix:/run/php/php8.4-fpm.sock;
|
||||
fastcgi_index index.php;
|
||||
include fastcgi_params;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
fastcgi_read_timeout 300;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
4. **Map domain in /etc/hosts**
|
||||
|
||||
127.0.0.1 customer1.lxdapp.local
|
||||
```bash
|
||||
127.0.0.1 mitul.lxdapp.local
|
||||
|
||||
5. **Make sure LXD is working**
|
||||
|
||||
```bash
|
||||
lxc list
|
||||
|
||||
6. **🔐 CAPTCHA Protection**
|
||||
@ -106,7 +104,7 @@ server {
|
||||
POST /api/v1/proxy
|
||||
|
||||
**Request Body:**
|
||||
|
||||
```bash
|
||||
{
|
||||
"source": "login",
|
||||
"panswer": "abc123"
|
||||
@ -114,19 +112,16 @@ server {
|
||||
|
||||
**Headers:**
|
||||
|
||||
Origin: http://customer1.lxdapp.local
|
||||
Origin: http://mitul.lxdapp.local
|
||||
|
||||
**Response:**
|
||||
|
||||
```bash
|
||||
{
|
||||
"status": "success",
|
||||
"ip": "10.210.189.24"
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**🧠 Notes**
|
||||
|
||||
Container names are auto-generated using the subdomain prefix.
|
||||
@ -144,6 +139,7 @@ server {
|
||||
public/last-access-logs/container-*.txt
|
||||
|
||||
NGINX error logs (for debugging):
|
||||
```bash
|
||||
tail -f /var/log/nginx/error.log
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user