-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathnginx.conf.example
More file actions
74 lines (60 loc) · 2.44 KB
/
nginx.conf.example
File metadata and controls
74 lines (60 loc) · 2.44 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
# Example nginx configuration for conceal.network
# Place this in /etc/nginx/sites-available/conceal.network
# Then create symlink: sudo ln -s /etc/nginx/sites-available/conceal.network /etc/nginx/sites-enabled/
server {
listen 80;
listen [::]:80;
server_name conceal.network www.conceal.network;
# Redirect HTTP to HTTPS
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name conceal.network www.conceal.network;
# SSL certificates (adjust paths as needed)
# Use Let's Encrypt: certbot certonly --nginx -d conceal.network -d www.conceal.network
ssl_certificate /etc/letsencrypt/live/conceal.network/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/conceal.network/privkey.pem;
# SSL configuration
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
# Root directory (where dist folder is deployed)
root /var/www/conceal.network;
index index.html;
# 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;
# Proxy for pools API (handles CORS)
location /api/pools {
proxy_pass https://explorer.conceal.network/services/pools/data;
proxy_set_header Host explorer.conceal.network;
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;
# CORS headers
add_header Access-Control-Allow-Origin * always;
add_header Access-Control-Allow-Methods "GET, OPTIONS" always;
add_header Access-Control-Allow-Headers "Content-Type" always;
if ($request_method = 'OPTIONS') {
return 204;
}
}
# Handle React Router (SPA routing)
location / {
try_files $uri $uri/ /index.html;
}
# Cache static assets
location ~* \.(jpg|jpeg|png|gif|ico|css|js|svg|woff|woff2|ttf|eot)$ {
expires 1y;
add_header Cache-Control "public, immutable";
}
# 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 "no-referrer-when-downgrade" always;
}