forked from cvquesty/openvox-gui
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnginx.conf
More file actions
73 lines (60 loc) · 2.36 KB
/
Copy pathnginx.conf
File metadata and controls
73 lines (60 loc) · 2.36 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
# Nginx configuration for OpenVox GUI
# This file should be placed in /etc/nginx/sites-available/openvox-gui
server {
listen 8080 ssl;
server_name YOUR_HOSTNAME;
ssl_certificate /etc/puppetlabs/puppet/ssl/certs/YOUR_HOSTNAME.pem;
ssl_certificate_key /etc/puppetlabs/puppet/ssl/private_keys/YOUR_HOSTNAME.pem;
root /opt/openvox-gui/frontend/dist;
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;
# Cache control for different file types
location / {
try_files $uri $uri/ /index.html;
# HTML files should never be cached
location ~ \.html$ {
add_header Cache-Control "no-cache, no-store, must-revalidate";
add_header Pragma "no-cache";
add_header Expires "0";
}
}
# Static assets with hash in filename can be cached forever
location /assets/ {
# Files with hash in name can be cached long-term
location ~ \-[a-zA-Z0-9]{8}\. {
add_header Cache-Control "public, max-age=31536000, immutable";
}
# Other assets get shorter cache
add_header Cache-Control "public, max-age=3600";
}
# API proxy
location /api/ {
proxy_pass http://localhost:4567;
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;
# WebSocket support
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
# No caching for API
add_header Cache-Control "no-cache, no-store, must-revalidate";
}
# Disable caching for service worker
location /sw.js {
add_header Cache-Control "no-cache, no-store, must-revalidate";
add_header Pragma "no-cache";
add_header Expires "0";
}
# Gzip compression
gzip on;
gzip_vary on;
gzip_min_length 10240;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml application/javascript application/json;
gzip_disable "MSIE [1-6]\.";
}