服务器上,rails项目找不到public,assets,uploads等文件时,配置一下nginx即可
进入项目的nginx.cof文件(添加代码):
location ~ ^/assets/ {
root /var/data/cms/current/public;
expires 1y;
add_header Cache-Control public;
add_header ETag "";
break;
}
location ~ ^/uploads/ {
root /var/data/cms/current/public;
expires 1y;
add_header Cache-Control public;
add_header ETag "";
break;
}
root /var/data/cms/current/public;
expires 1y;
add_header Cache-Control public;
add_header ETag "";
break;
}
location ~ ^/uploads/ {
root /var/data/cms/current/public;
expires 1y;
add_header Cache-Control public;
add_header ETag "";
break;
}