Stack:Elastic Bean,Ruby 2.1,Puma,Rails 3
nginx的EB默认配置是将/资产请求定向到位置:app_path / public / assets。我们需要将/ assets作为请求指向应用程序,例如myapp.elasticbeanstalk.com/products。换句话说,我们的应用程序在db,Asset model和routes中有资产表.rb定义资产资源。
我尝试了下面的hook / config,但没有运气。它给出了sigterm错误。
# .ebextensions/z_assets.conf
files:
"/etc/nginx/conf.d/z_assets.conf":
mode: "000755"
owner: root
group: root
content: |
server {
listen 80;
server_name _ localhost; # need to listen to localhost for worker tier
location /assets {
proxy_pass http://my_app/assets;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}