-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnginx.conf
More file actions
90 lines (78 loc) · 2.56 KB
/
nginx.conf
File metadata and controls
90 lines (78 loc) · 2.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
upstream optifood_backend {
server 127.0.0.1:8000;
}
upstream seratonin_backend {
server 127.0.0.1:8001;
}
upstream ai_email_backend {
server 127.0.0.1:8002;
}
server {
server_name optifood-ai.duckdns.org;
client_max_body_size 20M;
# Block scanners and hidden files
location ~ /\.(?!well-known).* {
deny all;
access_log off;
log_not_found off;
}
location ~* /(vendor|phpunit|laravel|wp-admin|wp-content|backup|myadmin|setup|config) {
access_log off;
log_not_found off;
return 444;
}
location ~* \.php$ {
access_log off;
log_not_found off;
return 444;
}
# Optifood (root)
location / {
proxy_pass http://optifood_backend;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_connect_timeout 60s;
proxy_read_timeout 120s;
proxy_send_timeout 120s;
}
# Seratonin — strip /seratonin prefix before passing to FastAPI
location /seratonin/ {
proxy_pass http://seratonin_backend/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_connect_timeout 60s;
proxy_read_timeout 120s;
proxy_send_timeout 120s;
}
location /ai-email/ {
proxy_pass http://ai_email_backend/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_connect_timeout 60s;
proxy_read_timeout 120s;
proxy_send_timeout 120s;
}
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
add_header X-Frame-Options SAMEORIGIN;
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
listen 443 ssl;
ssl_certificate /etc/letsencrypt/live/optifood-ai.duckdns.org/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/optifood-ai.duckdns.org/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
}
server {
listen 80;
server_name optifood-ai.duckdns.org;
if ($host = optifood-ai.duckdns.org) {
return 301 https://$host$request_uri;
}
return 404;
}