-
Notifications
You must be signed in to change notification settings - Fork 2
/
meteorServeStatic.conf
60 lines (54 loc) · 2.02 KB
/
meteorServeStatic.conf
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
# configure backend Meteor servers
# one line per instance
upstream meteor_server {
server 192.168.2.71:3000; #locally running Meteor on port 3000
ip_hash;
}
## actual site configuration
server {
server_name meteor;
## performance boost using gzip
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
# end of GZIP block
## this is the actual load balancing to the meteor backend servers
location / {
proxy_pass http://meteor_server; # the name used in upstreams, substituted for any of the defined instances
proxy_redirect off;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
# Make sure to use WebSockets
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
## if nginx has access to the js and css files created by meteor, you can proxy these as well
location ~* "^/[a-z0-9]{40}\.(css|js)$" {
root /opt/meteor/app/programs/web.browser;
access_log off;
expires 30d;
add_header Pragma public;
add_header Cache-Control "public";
}
## serve static files by nginx instead of Meteor (the public/ folder)
location ~ \.(jpg|jpeg|png|gif|mp3|ico|pdf) {
root /opt/meteor/app/programs/web.browser/app; # this should point at the content from the public folder
access_log off;
expires 30d;
add_header Pragma public;
add_header Cache-Control "public";
}
## serve static files from packages by nginx instead of Meteor
location ^~ /packages {
# this should point at the content from the app folder
root /opt/carrusel/app/programs/web.browser;
access_log off;
expires 30d;
add_header Pragma public;
add_header Cache-Control "public";
}
}