I have a web server with Nginx and Passenger.
I have uploaded my rails app and got it running. Everything was great, but then I decided to change an image (overwrite it with another one). I did that, and then deployed again. I have verified that the new image was at the assets/images folder.
The problem is that I refreshed the web app, and the html was referencing the old image. It was like this, until I restarted nginx. Isn't any other way to reloading this? Because if i have multiple web app on the same server, I don't want to restarting them all just because I updated one web assets.
My nginx conf:
server {
# Path to ruby version
passenger_ruby /home/ubuntu/.rvm/gems/ruby-2.2.1/wrappers/ruby;
listen 80;
server_name mydomain.com;
passenger_enabled on;
root /var/www/myrailsapp/current/public;
rails_env production;
location ~ ^/assets/ {
expires 1y;
add_header Cache-Control public;
add_header ETag "";
break;
}
location ~* .(jpg|jpeg|png|gif|ico|css|js)$ {
expires 365d;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
Do you know what is the problem and how can I avoid to restart nginx for reloading the new image?
Instead of restarting nginx, just restart passenger:
touch <app_dir>/tmp/restart.txt