1
1
server {
2
2
server_name localhost 89.111.174.61;
3
+ listen 80;
3
4
4
- location /django-static/ {
5
- alias /var/www/staticfiles/;
5
+ # Static files from public directory
6
+ location /build/ {
7
+ alias /var/www/html/build/;
8
+ add_header Cache-Control "public, max-age=31536000, immutable";
6
9
}
7
10
8
- location /static/ {
9
- alias /var/www/html/static/;
11
+ # Other static files (favicon, manifest, etc)
12
+ location ~* \.(ico|png|json|txt)$ {
13
+ root /var/www/html;
14
+ try_files $uri =404;
15
+ add_header Cache-Control "public, max-age=31536000";
10
16
}
11
17
12
- # Serve the main index.html file for the ReactJS frontend
13
- location / {
14
- root /var/www/html;
15
- try_files $uri /index.html;
18
+ location /django-static/ {
19
+ alias /var/www/staticfiles/;
16
20
}
17
21
18
22
location /admin/ {
19
- proxy_pass http://django-dev:8000;
20
- proxy_set_header Host $host;
21
- proxy_set_header X-Real-IP $remote_addr;
22
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
23
- proxy_set_header X-Forwarded-Proto $scheme;
23
+ proxy_pass http://django-dev:8000;
24
+ proxy_set_header Host $host;
25
+ proxy_set_header X-Real-IP $remote_addr;
26
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
27
+ proxy_set_header X-Forwarded-Proto $scheme;
24
28
}
25
29
26
30
location /api/ {
@@ -43,53 +47,23 @@ server {
43
47
proxy_set_header X-Forwarded-Proto $scheme;
44
48
}
45
49
46
- # Vite dev server proxy
47
- location /ws {
48
- proxy_pass http://host.docker.internal:5173;
49
- proxy_http_version 1.1;
50
- proxy_set_header Upgrade $http_upgrade;
51
- proxy_set_header Connection "Upgrade";
52
- proxy_set_header Host $host;
53
- proxy_cache_bypass $http_upgrade;
54
- }
55
-
56
- # Serve static files from Vite
57
- location /@fs/ {
58
- proxy_pass http://host.docker.internal:5173;
59
- proxy_http_version 1.1;
60
- proxy_set_header Host $host;
61
- proxy_cache_bypass $http_upgrade;
62
- }
63
-
64
- location /@vite/ {
65
- proxy_pass http://host.docker.internal:5173;
66
- proxy_http_version 1.1;
67
- proxy_set_header Host $host;
68
- proxy_cache_bypass $http_upgrade;
69
- }
70
-
71
- location /node_modules/ {
72
- proxy_pass http://host.docker.internal:5173;
73
- proxy_http_version 1.1;
74
- proxy_set_header Host $host;
75
- proxy_cache_bypass $http_upgrade;
50
+ location /media/ {
51
+ alias /var/www/media/;
76
52
}
77
53
78
- location /src/ {
79
- proxy_pass http://host.docker.internal:5173;
54
+ # All other requests go to Remix
55
+ location / {
56
+ proxy_pass http://frontend-dev:3000;
80
57
proxy_http_version 1.1;
58
+ proxy_set_header Upgrade $http_upgrade;
59
+ proxy_set_header Connection 'upgrade';
81
60
proxy_set_header Host $host;
61
+ proxy_set_header X-Real-IP $remote_addr;
62
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
63
+ proxy_set_header X-Forwarded-Proto $scheme;
82
64
proxy_cache_bypass $http_upgrade;
65
+
66
+ # Prevent redirect loops
67
+ proxy_redirect off;
83
68
}
84
-
85
- location /media/ {
86
- alias /var/www/media/;
87
- }
88
- }
89
-
90
- server {
91
- server_name localhost;
92
-
93
- listen 80;
94
- return 301 https://$host$request_uri;
95
69
}
0 commit comments