56 lines
1.7 KiB
Nginx Configuration File
56 lines
1.7 KiB
Nginx Configuration File
upstream canto_backend {
|
|
server 127.0.0.1:8000;
|
|
}
|
|
|
|
server {
|
|
listen 80;
|
|
server_name your-domain.com;
|
|
|
|
client_max_body_size 100M;
|
|
client_body_timeout 300s;
|
|
proxy_read_timeout 300s;
|
|
proxy_connect_timeout 300s;
|
|
proxy_send_timeout 300s;
|
|
|
|
location / {
|
|
proxy_pass http://canto_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;
|
|
|
|
add_header 'Access-Control-Allow-Origin' '*' always;
|
|
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always;
|
|
add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type' always;
|
|
|
|
if ($request_method = 'OPTIONS') {
|
|
add_header 'Access-Control-Allow-Origin' '*';
|
|
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS';
|
|
add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type';
|
|
add_header 'Content-Length' '0';
|
|
add_header 'Content-Type' 'text/plain';
|
|
return 204;
|
|
}
|
|
}
|
|
|
|
location /outputs/ {
|
|
alias /opt/canto-backend/outputs/;
|
|
autoindex off;
|
|
add_header Cache-Control "public, max-age=3600";
|
|
add_header Content-Disposition "attachment";
|
|
}
|
|
|
|
location /health {
|
|
proxy_pass http://canto_backend/health;
|
|
proxy_set_header Host $host;
|
|
access_log off;
|
|
}
|
|
|
|
location /metrics {
|
|
proxy_pass http://canto_backend/metrics;
|
|
proxy_set_header Host $host;
|
|
allow 127.0.0.1;
|
|
deny all;
|
|
}
|
|
}
|