fedi-feed-router/docker/production/nginx.conf
2025-08-15 02:58:14 +02:00

82 lines
No EOL
1.9 KiB
Nginx Configuration File

server {
listen 80;
server_name localhost;
# Serve static React build files
root /var/www/html/frontend/dist;
index index.html;
# API requests to Laravel backend
location /api/ {
root /var/www/html/backend/public;
try_files /index.php =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/html/backend/public/index.php;
include fastcgi_params;
# Increase timeouts for long-running requests
fastcgi_read_timeout 300;
fastcgi_send_timeout 300;
}
# Serve Laravel public assets (images, etc.)
location /images/ {
alias /var/www/html/backend/public/images/;
expires 1y;
add_header Cache-Control "public, immutable";
}
# React app - catch all routes
location / {
try_files $uri $uri/ /index.html;
}
# Static assets with far-future expiry
location ~* \.(css|js|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot|map)$ {
expires 1y;
add_header Cache-Control "public, immutable";
access_log off;
}
# Security headers
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
add_header X-XSS-Protection "1; mode=block";
# Deny access to hidden files
location ~ /\.ht {
deny all;
}
# Deny access to sensitive files
location ~ /\.(env|git) {
deny all;
}
location = /favicon.ico {
access_log off;
log_not_found off;
}
location = /robots.txt {
access_log off;
log_not_found off;
}
# Gzip compression
gzip on;
gzip_vary on;
gzip_min_length 1024;
gzip_proxied any;
gzip_comp_level 6;
gzip_types
text/plain
text/css
text/xml
text/javascript
application/javascript
application/xml+rss
application/json;
}