【问题标题】:How to host assets locally under different hostname?如何以不同的主机名在本地托管资产?
【发布时间】:2012-12-21 18:46:14
【问题描述】:

我想测试来自多个主机名的资产,例如:http://assets1.somehost.dev, http://assets2.somehost.dev

我的资产配置来自development.rb

config.serve_static_assets = false
config.assets.compile = true
config.assets.digest = true
config.action_controller.asset_host = "http://assets%d.somehost.com"
config.assets.compress = false
config.assets.debug = false

所以我想设置config.action_controller.asset_host = "http://assets%d.somehost.dev"

在本地进行测试。

【问题讨论】:

    标签: ruby-on-rails ruby localhost asset-pipeline assets


    【解决方案1】:

    将以下行添加到您的主机文件中(我认为 rails 默认只使用四个资产主机):

    127.0.0.1 http://assets1.somehost.dev http://assets2.somehost.dev http://assets3.somehost.dev http://assets4.somehost.dev
    

    维基百科有一个基于您的平台的where to find your hosts file 列表。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-04-27
      • 2020-08-27
      • 1970-01-01
      • 1970-01-01
      • 2021-08-11
      • 2016-07-15
      • 2019-08-10
      相关资源
      最近更新 更多