-
-
Notifications
You must be signed in to change notification settings - Fork 257
Expand file tree
/
Copy pathnginx.conf
More file actions
57 lines (49 loc) · 1.59 KB
/
nginx.conf
File metadata and controls
57 lines (49 loc) · 1.59 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
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
# Events block
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream; sendfile on;
keepalive_timeout 65;
server {
listen 8080;
server_name localhost;
root /usr/share/nginx/html;
index index.html;
# Handle JavaScript modules with correct MIME type for any base path
location ~* ^/.*/assets/.*\.(js|mjs)$ {
add_header Content-Type application/javascript;
try_files $uri =404;
expires 1y;
add_header Cache-Control "public, immutable";
}
# Handle CSS files with correct MIME type for any base path
location ~* ^/.*/assets/.*\.css$ {
add_header Content-Type text/css;
try_files $uri =404;
expires 1y;
add_header Cache-Control "public, immutable";
}
# Handle other static assets
location ~* \.(png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
try_files $uri =404;
expires 1y;
add_header Cache-Control "public, immutable";
}
location / {
try_files $uri $uri/ /index.html;
}
location /public/ {
alias /usr/share/nginx/html/public/;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
}