0

Right now I'm trying this in my .conf file. None of the pictures are showing up if I do this.

location ~*  \.(jpg|jpeg|png|gif|ico)$ {
    expires 365d;
}

location ~*  \.(pdf)$ {
    expires 30d;
}

I've already looked at this question (https://stackoverflow.com/a/18039576/582309) on SO and it doesn't address the problem I'm having using MUP.

I've also tried to include the root path to the build directory that MUP is creating, but that doesn't work either. Also, I removed the CSS and JS from the cache here because the pages doesn't load if those don't work and I wasn't sure if Meteor was already taking care of caching of these files.

location ~*  \.(jpg|jpeg|png|gif|ico)$ {
    root /opt/give/app/programs/web.browser; //tried many combinations of the path
    expires 365d;
}

location ~*  \.(pdf)$ {
    expires 30d;
}

Here is a GIST of the rest of the .conf file

Sites.conf GIST

https://gist.github.com/c316/9552ecdc8107334fc55d

location specific gist

https://gist.github.com/c316/4917d95cbfddd3e181ad

Community
  • 1
  • 1
JoshJoe
  • 1,482
  • 2
  • 17
  • 35
  • does this help? https://github.com/meteorinaction/appendices/blob/master/configuration/nginx/nginxsite.conf – Stephan Dec 02 '14 at 15:45
  • @Stephan is your root path the path to MUP or is that where you store your git repo or is it something else? – JoshJoe Dec 02 '14 at 15:54
  • Also, I am running meteor at a different root_url of /give instead of just the root url or / so I don't know if this would effect caching. – JoshJoe Dec 02 '14 at 15:58
  • MUP deploys to `/home/meteor/`. Have you looked at the error log for nginx to see what the problem is? – Stephan Dec 02 '14 at 16:50
  • @Stephan MUP doesn't deploy to that directory on my server. It is deploying to /opt/give/app/programs/web.browser. Here is what is in the error log. 11.11.11.11 - - [02/Dec/2014:20:21:42 -0600] "GET /give/images/check_image.png HTTP/1.1" 404 570 "https://trashmountain.com/give" – JoshJoe Dec 03 '14 at 02:25

1 Answers1

0

Turns out that to cache my images fonts and other public assets all I really needed to do it this.

Already had this top portion

location /give {
    proxy_pass http://trashmountainGive/app_name;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header Host $http_host;

    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forward-Proto http;
    proxy_set_header X-Nginx-Proxy true;

    proxy_redirect off;

    #Added everything below here

    location /give/images {
        alias /opt/app_name/app/programs/web.browser/app/images;
        access_log off;
        expires max;
    }

    location /give/fonts {
        alias /opt/app_name/app/programs/web.browser/app/fonts;
        access_log off;
        expires max;
    }
}

Checkout this article

http://nginx.com/blog/nginx-nodejs-websockets-socketio/

Scroll down to "What about Static Files?"

JoshJoe
  • 1,482
  • 2
  • 17
  • 35