File size: 1,197 Bytes
d97b8f9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
server {
    listen 80;
    server_name pm.synthesys.in;;
    root /var/www/pm;  # Path to your Vite dist folder - MAKE SURE THIS PATH IS CORRECT
    index index.html;

    # Important: Configure correct MIME types for modern JS
    include /etc/nginx/mime.types;
    
    # Explicitly set JavaScript MIME types
    types {
        application/javascript js;
        application/javascript mjs;
        text/javascript js;
        text/javascript mjs;
        text/css css;
        image/svg+xml svg;
        image/png png;
        image/jpeg jpg jpeg;
        image/gif gif;
        application/json json;
    }

    # Ensure assets folder serves JavaScript with correct MIME type
    location ~ \.js$ {
        add_header Content-Type application/javascript;
    }
    
    location ~ \.mjs$ {
        add_header Content-Type application/javascript;
    }

    location /assets/ {
        try_files $uri =404;
    }

    location / {
        try_files $uri $uri/ /index.html;
    }

    # Cache static assets
    location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
        expires 30d;
        add_header Cache-Control "public, no-transform";
    }
}