asset_sync gem error:rake assets:预编译失败:与服务器证书不匹配(OpenSSL :: SSL :: SSLError)

 mobiledu2502927333 发布于 2023-02-07 12:15

asset_sync gem error :(

我开始的第一个错误与unfgem有关,所以我添加gem "unf", "~> 0.1.3"到我的gemfile并再次尝试.没有运气:(经过更多研究后,我可能会遇到与我的aws桶相关的其他设置的问题.我的dns是通过route53托管的,我想使用自定义域来提供我的资产.这意味着我的桶看起来不像assets.domain.com只是一个简单的名称.当我尝试运行rake assets:precompilerake aborted! hostname "assets.domain.com.s3-us-west-1.amazonaws.com" does not match the server certificate (OpenSSL::SSL::SSLError)"时会出现错误但是错误似乎是错误的.为了使用你自己的子域即资产.我读到桶必须设置为静态网站.这意味着网址看起来assets.domain.com.s3-website-us-west-1.amazonaws.com似乎与错误代码不匹配.

我在这里错过了一个设置吗?也许我很疯狂...谢谢你的帮助.

我的production.rb设置

# Enable serving of images, stylesheets, and JavaScripts from an asset server.
AssetSync.config.run_on_precompile = true
config.action_controller.asset_host = "http://assets.domain.com"
config.assets.prefix = "/data"

config.assets.enabled = true
config.assets.compile = true
config.assets.initialize_on_precompile = true

# Generate digests for assets URLs.
config.assets.digest = true

我当前的初始化文件:

if defined?(AssetSync)
  AssetSync.configure do |config|
    config.fog_provider = 'AWS'
    config.aws_access_key_id = ENV['MY_S3_ID']
    config.aws_secret_access_key = ENV['MY_S3_SECRET']
    # To use AWS reduced redundancy storage.
    # config.aws_reduced_redundancy = true
    config.fog_directory = ENV['MY_S3_BUCKET']

    # Invalidate a file on a cdn after uploading files
    # config.cdn_distribution_id = "12345"
    # config.invalidate = ['file1.js']

    # Increase upload performance by configuring your region
    config.fog_region = ENV['MY_S3_ENDPOINT']
    #
    # Don't delete files from the store
    # config.existing_remote_files = "keep"
    #
    # Automatically replace files with their equivalent gzip compressed version
    # config.gzip_compression = true
    #
    # Use the Rails generated 'manifest.yml' file to produce the list of files to
    # upload instead of searching the assets directory.
    # config.manifest = true
    #
    # Fail silently.  Useful for environments such as Heroku
    # config.fail_silently = true
  end
end

Chris Hough.. 8

修正了:Fog.credentials = {path_style:true}

if defined?(AssetSync)
  AssetSync.configure do |config|
    config.fog_provider = 'AWS'
    config.aws_access_key_id = ENV['MY_S3_ID']
    config.aws_secret_access_key = ENV['MY_S3_SECRET']
    # To use AWS reduced redundancy storage.
    # config.aws_reduced_redundancy = true
    config.fog_directory = ENV['MY_S3_BUCKET']

    # Invalidate a file on a cdn after uploading files
    # config.cdn_distribution_id = "12345"
    # config.invalidate = ['file1.js']

    Fog.credentials = { path_style: true }

    # Increase upload performance by configuring your region
    config.fog_region = ENV['MY_S3_ENDPOINT']
    #
    # Don't delete files from the store
    # config.existing_remote_files = "keep"
    #
    # Automatically replace files with their equivalent gzip compressed version
    # config.gzip_compression = true
    #
    # Use the Rails generated 'manifest.yml' file to produce the list of files to
    # upload instead of searching the assets directory.
    # config.manifest = true
    #
    # Fail silently.  Useful for environments such as Heroku
    # config.fail_silently = true
  end
end

参考问题:https://github.com/rumblelabs/asset_sync/issues/236,https://github.com/fog/fog/issues/2357

1 个回答
  • 修正了:Fog.credentials = {path_style:true}

    if defined?(AssetSync)
      AssetSync.configure do |config|
        config.fog_provider = 'AWS'
        config.aws_access_key_id = ENV['MY_S3_ID']
        config.aws_secret_access_key = ENV['MY_S3_SECRET']
        # To use AWS reduced redundancy storage.
        # config.aws_reduced_redundancy = true
        config.fog_directory = ENV['MY_S3_BUCKET']
    
        # Invalidate a file on a cdn after uploading files
        # config.cdn_distribution_id = "12345"
        # config.invalidate = ['file1.js']
    
        Fog.credentials = { path_style: true }
    
        # Increase upload performance by configuring your region
        config.fog_region = ENV['MY_S3_ENDPOINT']
        #
        # Don't delete files from the store
        # config.existing_remote_files = "keep"
        #
        # Automatically replace files with their equivalent gzip compressed version
        # config.gzip_compression = true
        #
        # Use the Rails generated 'manifest.yml' file to produce the list of files to
        # upload instead of searching the assets directory.
        # config.manifest = true
        #
        # Fail silently.  Useful for environments such as Heroku
        # config.fail_silently = true
      end
    end
    

    参考问题:https://github.com/rumblelabs/asset_sync/issues/236,https://github.com/fog/fog/issues/2357

    2023-02-07 12:18 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有