69 lines
2.4 KiB
Nginx Configuration File
69 lines
2.4 KiB
Nginx Configuration File
|
|
# Nginx configuration for Bridge DApp Frontend (Admin Panel)
|
||
|
|
# Note: This is DIFFERENT from mim4u.org (which uses VMID 7810)
|
||
|
|
# Deploy to: /etc/nginx/sites-available/bridge-dapp
|
||
|
|
# Symlink to: /etc/nginx/sites-enabled/bridge-dapp
|
||
|
|
|
||
|
|
server {
|
||
|
|
listen 80;
|
||
|
|
listen [::]:80;
|
||
|
|
server_name cross-all.defi-oracle.io;
|
||
|
|
|
||
|
|
root /var/www/html/bridge-dapp;
|
||
|
|
index index.html;
|
||
|
|
|
||
|
|
# Security headers
|
||
|
|
add_header X-Frame-Options "SAMEORIGIN" always;
|
||
|
|
add_header X-Content-Type-Options "nosniff" always;
|
||
|
|
add_header X-XSS-Protection "1; mode=block" always;
|
||
|
|
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
||
|
|
|
||
|
|
# Gzip compression
|
||
|
|
gzip on;
|
||
|
|
gzip_vary on;
|
||
|
|
gzip_min_length 1024;
|
||
|
|
gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml+rss application/json application/javascript;
|
||
|
|
|
||
|
|
# Cache static assets
|
||
|
|
location ~* \.(jpg|jpeg|png|gif|ico|css|js|svg|woff|woff2|ttf|eot)$ {
|
||
|
|
expires 1y;
|
||
|
|
add_header Cache-Control "public, immutable";
|
||
|
|
access_log off;
|
||
|
|
}
|
||
|
|
|
||
|
|
# SPA routing - serve index.html for all routes
|
||
|
|
location / {
|
||
|
|
try_files $uri $uri/ /index.html;
|
||
|
|
|
||
|
|
# Security headers from _headers file
|
||
|
|
add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://cdn.ethers.io https://cdn.jsdelivr.net https://unpkg.com; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self' https://fonts.gstatic.com; img-src 'self' data: https:; connect-src 'self' https: http://192.168.11.250:8545 ws://192.168.11.250:8546 wss:; frame-ancestors 'self';" always;
|
||
|
|
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
||
|
|
}
|
||
|
|
|
||
|
|
# API proxy (if needed)
|
||
|
|
location /api/ {
|
||
|
|
proxy_pass http://192.168.11.250:8545;
|
||
|
|
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;
|
||
|
|
}
|
||
|
|
|
||
|
|
# Deny access to hidden files
|
||
|
|
location ~ /\. {
|
||
|
|
deny all;
|
||
|
|
access_log off;
|
||
|
|
log_not_found off;
|
||
|
|
}
|
||
|
|
|
||
|
|
# Error pages
|
||
|
|
error_page 404 /index.html;
|
||
|
|
error_page 500 502 503 504 /50x.html;
|
||
|
|
location = /50x.html {
|
||
|
|
root /usr/share/nginx/html;
|
||
|
|
}
|
||
|
|
|
||
|
|
# Logging
|
||
|
|
access_log /var/log/nginx/frontend-dapp-access.log;
|
||
|
|
error_log /var/log/nginx/frontend-dapp-error.log;
|
||
|
|
}
|