Skip to content

Commit 6991653

Browse files
committed
add nginx
1 parent bbfa128 commit 6991653

2 files changed

Lines changed: 41 additions & 2 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ jobs:
2525
2626
- name: Run backend tests
2727
run: |
28-
cd backend
29-
pytest -v tests/
28+
pytest -v backend/tests/
3029
3130
deploy:
3231
runs-on: ubuntu-latest

detection.nginx

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# === HTTPS Server ===
2+
server {
3+
listen 443 ssl;
4+
server_name kh_detection.com www.kh_detection.com;
5+
6+
# SSL Certificates
7+
ssl_certificate /etc/nginx/ssl/selfsigned.crt;
8+
ssl_certificate_key /etc/nginx/ssl/selfsigned.key;
9+
10+
ssl_protocols TLSv1.2 TLSv1.3;
11+
ssl_ciphers HIGH:!aNULL:!MD5;
12+
13+
# === Frontend (React) ===
14+
root /home/ny/projects/final/frontend/build; # <- use /build for React production build
15+
index index.html;
16+
17+
# Serve React app
18+
location / {
19+
try_files $uri /index.html;
20+
}
21+
22+
# === Backend (FastAPI) ===
23+
location /api/ {
24+
proxy_pass http://127.0.0.1:8000/;
25+
proxy_set_header Host $host;
26+
proxy_set_header X-Real-IP $remote_addr;
27+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
28+
proxy_set_header X-Forwarded-Proto $scheme;
29+
}
30+
31+
# Optional: handle CORS or large payloads
32+
client_max_body_size 20M;
33+
}
34+
35+
# === HTTP → HTTPS Redirect ===
36+
server {
37+
listen 80;
38+
server_name kh_detection.com www.kh_detection.com;
39+
return 301 https://$host$request_uri;
40+
}

0 commit comments

Comments
 (0)