Files
PromptTech/nginx-prompttech.conf

76 lines
2.3 KiB
Plaintext

# Nginx Configuration for PromptTech Solution Site
# Port: 5300 (Frontend) and 8181 (Backend API)
server {
listen 5300;
listen [::]:5300;
server_name prompttech.dynns.com localhost;
# Disable ModSecurity for this site
modsecurity off;
# Buffer sizes
large_client_header_buffers 4 32k;
client_header_buffer_size 8k;
# Logs
access_log /var/log/nginx/prompttech-access.log;
error_log /var/log/nginx/prompttech-error.log;
# Gzip Compression
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_types text/plain text/css text/xml application/json application/javascript application/rss+xml application/atom+xml image/svg+xml;
# Serve built React static files
root /media/pts/Website/PromptTech_Solution_Site/frontend/build;
index index.html index.htm;
location / {
try_files $uri $uri/ /index.html;
}
# Static file caching
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
expires 1y;
add_header Cache-Control "public, immutable";
}
# API proxy to FastAPI backend
location /api/ {
proxy_pass http://127.0.0.1:8181;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
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_cache_bypass $http_upgrade;
# Allow large file uploads
client_max_body_size 100M;
# Timeouts for large uploads
proxy_connect_timeout 300s;
proxy_send_timeout 300s;
proxy_read_timeout 300s;
}
# Proxy uploads to backend (media files) - ^~ prevents regex match
location ^~ /uploads/ {
proxy_pass http://127.0.0.1:8181/uploads/;
proxy_http_version 1.1;
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;
# Cache uploaded media files
expires 1y;
add_header Cache-Control "public, immutable";
}
}