My nginx.conf file is using the recommended config from the rails guides:
server {
listen 80;
server_name mysite.org;
root /home/ec2-user/sites/mysite/production/current/public;
location ~ ^/assets/ {
expires 1y;
add_header Cache-Control public;
add_header ETag "";
break;
}
location / {
proxy_pass http://backend-mysite;
}
}
Problem is requests for css and js compiled files like this:
http://mysite.org/assets/application-0230217054b1f5b5f386a270a526ceca.css
are returning 403 status.
I've taken a look and I can see the asset files are there in public/assets/
What is wrong with my nginx configuration?
Figured it out. I wasn't looking at the nginx error log before for some reason. Once I looked there I could see that those assets were getting "permission denied" error for them. I tracked down this problem and had to make sure every directory from the root to the location of the asset files had:
chmod +x
on it.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.