• 请问现在这个还能签发证书么?

    我输入

    acme.sh --issue -d subdomain.domain.com --webroot /home/app/public 
    

    之后得到 challenge 不存在的报错,但我十分确定目录没问题,查看没有 challenge 因为是它自动完成后删除了,以下是 log

    Changing owner/group of .well-known to root:root
    [Thu Aug 17 15:06:09 CST 2017] url='https://acme-v01.api.letsencrypt.org/acme/challenge/u0FsYtePfxD34xYlhDA_dqdvYhMIHnybo_vx30r56wA/1769980106'
    [Thu Aug 17 15:06:09 CST 2017] payload='{"resource": "challenge", "keyAuthorization": "MAkvAMKQ3bCT3it0-sx4ZufmZxtEsTkUncsAqVy-iRw._VvrU6EE4CB0GRLOlaXCczJU63JAchPg8nrv4mbtF7w"}'
    [Thu Aug 17 15:06:09 CST 2017] POST
    [Thu Aug 17 15:06:09 CST 2017] url='https://acme-v01.api.letsencrypt.org/acme/challenge/u0FsYtePfxD34xYlhDA_dqdvYhMIHnybo_vx30r56wA/1769980106'
    [Thu Aug 17 15:06:09 CST 2017] _CURL='curl -L --silent --dump-header /root/.acme.sh/http.header '
    [Thu Aug 17 15:06:11 CST 2017] _ret='0'
    [Thu Aug 17 15:06:11 CST 2017] code='202'
    [Thu Aug 17 15:06:11 CST 2017] sleep 2 secs to verify
    [Thu Aug 17 15:06:13 CST 2017] checking
    [Thu Aug 17 15:06:13 CST 2017] GET
    [Thu Aug 17 15:06:13 CST 2017] url='https://acme-v01.api.letsencrypt.org/acme/challenge/u0FsYtePfxD34xYlhDA_dqdvYhMIHnybo_vx30r56wA/1769980106'
    [Thu Aug 17 15:06:13 CST 2017] timeout
    

    好象是获取 api 失败了,这是脚本的问题么?


    不是脚本的问题,我 public 路径没有配置好

  • 大神你说的太对了,重启好了

  • 还好我服务器有备份。。。那我换个服务器?

  • require "sport"
    NameError: uninitialized constant ApplicationRecord
            from /home/sports_meeting/app/models/sport.rb:1:in `<top (required
    

    这回更奇怪。。。

  • /home/sports_meeting/lib
    /home/sports_meeting/vendor
    /home/sports_meeting/app/assets
    /home/sports_meeting/app/channels
    /home/sports_meeting/app/controllers
    /home/sports_meeting/app/controllers/concerns
    /home/sports_meeting/app/helpers
    /home/sports_meeting/app/jobs
    /home/sports_meeting/app/mailers
    /home/sports_meeting/app/models
    /home/sports_meeting/app/models/concerns
    /usr/local/rvm/gems/ruby-2.2.2/gems/turbolinks-5.0.1/lib
    /usr/local/rvm/gems/ruby-2.2.2/gems/jquery-rails-4.2.2/lib
    /usr/local/rvm/gems/ruby-2.2.2/gems/jquery-rails-4.2.2/vendor
    /usr/local/rvm/gems/ruby-2.2.2/gems/coffee-rails-4.2.1/lib
    /usr/local/rvm/gems/ruby-2.2.2/gems/actioncable-5.0.2/lib
    /usr/local/rvm/gems/ruby-2.2.2/gems/bundler-1.14.3/lib
    /usr/local/rvm/gems/ruby-2.2.2/gems/spring-2.0.1/lib
    /usr/local/rvm/gems/ruby-2.2.2/gems/web-console-3.4.0/lib
    /usr/local/rvm/gems/ruby-2.2.2/gems/uglifier-3.1.9/lib
    /usr/local/rvm/gems/ruby-2.2.2/gems/turbolinks-source-5.0.0/lib
    /usr/local/rvm/gems/ruby-2.2.2/gems/sqlite3-1.3.13/lib
    /usr/local/rvm/gems/ruby-2.2.2/extensions/x86_64-linux/2.2.0/sqlite3-1.3.13
    /usr/local/rvm/gems/ruby-2.2.2/gems/spring-watcher-listen-2.0.1/lib
    /usr/local/rvm/gems/ruby-2.2.2/gems/sass-rails-5.0.6/lib
    /usr/local/rvm/gems/ruby-2.2.2/gems/tilt-2.0.7/lib
    /usr/local/rvm/gems/ruby-2.2.2/gems/sass-3.4.23/lib
    /usr/local/rvm/gems/ruby-2.2.2/gems/rails-5.0.2/lib
    /usr/local/rvm/gems/ruby-2.2.2/gems/sprockets-rails-3.2.0/lib
    /usr/local/rvm/gems/ruby-2.2.2/gems/sprockets-3.7.1/lib
    /usr/local/rvm/gems/ruby-2.2.2/gems/puma-3.8.2/lib
    /usr/local/rvm/gems/ruby-2.2.2/extensions/x86_64-linux/2.2.0/puma-3.8.2
    /usr/local/rvm/gems/ruby-2.2.2/gems/listen-3.0.8/lib
    /usr/local/rvm/gems/ruby-2.2.2/gems/rb-inotify-0.9.8/lib
    /usr/local/rvm/gems/ruby-2.2.2/gems/rb-fsevent-0.9.8/lib
    /usr/local/rvm/gems/ruby-2.2.2/gems/jbuilder-2.6.3/lib
    /usr/local/rvm/gems/ruby-2.2.2/gems/multi_json-1.12.1/lib
    /usr/local/rvm/gems/ruby-2.2.2/gems/ffi-1.9.18/lib
    /usr/local/rvm/gems/ruby-2.2.2/extensions/x86_64-linux/2.2.0/ffi-1.9.18
    /usr/local/rvm/gems/ruby-2.2.2/gems/debug_inspector-0.0.2/lib
    /usr/local/rvm/gems/ruby-2.2.2/extensions/x86_64-linux/2.2.0/debug_inspector-0.0.2
    /usr/local/rvm/gems/ruby-2.2.2/gems/railties-5.0.2/lib
    /usr/local/rvm/gems/ruby-2.2.2/gems/thor-0.19.4/lib
    /usr/local/rvm/gems/ruby-2.2.2/gems/method_source-0.8.2/lib
    /usr/local/rvm/gems/ruby-2.2.2/gems/coffee-script-2.4.1/lib
    /usr/local/rvm/gems/ruby-2.2.2/gems/execjs-2.7.0/lib
    /usr/local/rvm/gems/ruby-2.2.2/gems/coffee-script-source-1.12.2/lib
    /usr/local/rvm/gems/ruby-2.2.2/gems/byebug-9.0.6/lib
    /usr/local/rvm/gems/ruby-2.2.2/extensions/x86_64-linux/2.2.0/byebug-9.0.6
    /usr/local/rvm/gems/ruby-2.2.2/gems/bcrypt-3.1.11/lib
    /usr/local/rvm/gems/ruby-2.2.2/extensions/x86_64-linux/2.2.0/bcrypt-3.1.11
    /usr/local/rvm/gems/ruby-2.2.2/gems/activerecord-5.0.2/lib
    /usr/local/rvm/gems/ruby-2.2.2/gems/arel-7.1.4/lib
    /usr/local/rvm/gems/ruby-2.2.2/gems/activemodel-5.0.2/lib
    /usr/local/rvm/gems/ruby-2.2.2/gems/actionmailer-5.0.2/lib
    /usr/local/rvm/gems/ruby-2.2.2/gems/mail-2.6.4/lib
    /usr/local/rvm/gems/ruby-2.2.2/gems/mime-types-3.1/lib
    /usr/local/rvm/gems/ruby-2.2.2/gems/mime-types-data-3.2016.0521/lib
    /usr/local/rvm/gems/ruby-2.2.2/gems/activejob-5.0.2/lib
    /usr/local/rvm/gems/ruby-2.2.2/gems/globalid-0.3.7/lib
    /usr/local/rvm/gems/ruby-2.2.2/gems/websocket-driver-0.6.5/lib
    /usr/local/rvm/gems/ruby-2.2.2/extensions/x86_64-linux/2.2.0/websocket-driver-0.6.5
    /usr/local/rvm/gems/ruby-2.2.2/gems/websocket-extensions-0.1.2/lib
    /usr/local/rvm/gems/ruby-2.2.2/gems/nio4r-2.0.0/lib
    /usr/local/rvm/gems/ruby-2.2.2/extensions/x86_64-linux/2.2.0/nio4r-2.0.0
    /usr/local/rvm/gems/ruby-2.2.2/gems/actionpack-5.0.2/lib
    /usr/local/rvm/gems/ruby-2.2.2/gems/rack-test-0.6.3/lib
    /usr/local/rvm/gems/ruby-2.2.2/gems/rack-2.0.1/lib
    /usr/local/rvm/gems/ruby-2.2.2/gems/actionview-5.0.2/lib
    /usr/local/rvm/gems/ruby-2.2.2/gems/rails-html-sanitizer-1.0.3/lib
    /usr/local/rvm/gems/ruby-2.2.2/gems/loofah-2.0.3/lib
    /usr/local/rvm/gems/ruby-2.2.2/gems/rails-dom-testing-2.0.2/lib
    /usr/local/rvm/gems/ruby-2.2.2/gems/nokogiri-1.7.1/lib
    /usr/local/rvm/gems/ruby-2.2.2/extensions/x86_64-linux/2.2.0/nokogiri-1.7.1
    /usr/local/rvm/gems/ruby-2.2.2/gems/mini_portile2-2.1.0/lib
    /usr/local/rvm/gems/ruby-2.2.2/gems/erubis-2.7.0/lib
    /usr/local/rvm/gems/ruby-2.2.2/gems/builder-3.2.3/lib
    /usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-5.0.2/lib
    /usr/local/rvm/gems/ruby-2.2.2/gems/tzinfo-1.2.2/lib
    /usr/local/rvm/gems/ruby-2.2.2/gems/thread_safe-0.3.6/lib
    /usr/local/rvm/gems/ruby-2.2.2/gems/minitest-5.10.1/lib
    /usr/local/rvm/gems/ruby-2.2.2/gems/i18n-0.8.1/lib
    /usr/local/rvm/gems/ruby-2.2.2/gems/concurrent-ruby-1.0.5/lib
    /usr/local/rvm/gems/ruby-2.2.2/gems/rake-12.0.0/lib
    /usr/local/rvm/rubies/ruby-2.2.2/lib/ruby/site_ruby/2.2.0
    /usr/local/rvm/rubies/ruby-2.2.2/lib/ruby/site_ruby/2.2.0/x86_64-linux
    /usr/local/rvm/rubies/ruby-2.2.2/lib/ruby/site_ruby
    /usr/local/rvm/rubies/ruby-2.2.2/lib/ruby/vendor_ruby/2.2.0
    /usr/local/rvm/rubies/ruby-2.2.2/lib/ruby/vendor_ruby/2.2.0/x86_64-linux
    /usr/local/rvm/rubies/ruby-2.2.2/lib/ruby/vendor_ruby
    /usr/local/rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0
    /usr/local/rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/x86_64-linux
    

    这个是 LOAD_PATH...看起来没什么不对的....

  • 试过了,一样的结果,console 表示根本没不认识这些 Model

  • 其实我也没考虑那么多,买的时候啥都不懂,但是以前去新泽西旅游过结果就选那了。。。

    现在打算办到东京看看

  • 是么,我试试

  • 其实也不是完全跑网站,还想用它干点别的。。。

  • 唉,真的感觉国内也没便宜多少,linode 150 元/月 2 核 4G 有备份

    阿里,腾讯什么的同样价位还没有。。。。

  • 嗯,听说过这家,挺有名的。目前纠结是再寻找 cdn 还是换服务器了

  • 啊,各位,我蠢了,配置域名的关键在于 server_name,正确配置如下:

    upstream app1{
     server unix:/..../puma.sock;
    }
    upstream app2{
      server unix:/.../puma.sock;
    }
    
    server{
      listen 80;
      server_name a.xxx.com;
        location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_redirect off;
        proxy_pass http://myapp;
        }
    }
    
    server{
      listen 80;
      server_name b.xxx.com;
        location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_redirect off;
        proxy_pass http://myapp2;
        }
    }
    

    其实根本不需要担心两个 80 端口会冲突什么的,两个项目的运行是用 socks 进行代理的。 决定访问哪个域名去哪里的,最关键的还是 server_name 这一项

    自己之前猜想太多,这次一实践立刻就明白了,谢谢@flowerwrong

  • 唉,其实就是自己想用 socks 才会出这样的问题,把 puma 用 tcp 端口绑定应该就没问题了。虽然慢一点,但是应该能跑多个项目。

  • You mean I should change proxy_pass to the domain I want?

    eg. change http://app1 to http://app1.mydomain.com ?

    or change listen ports enter listen 80 in the first server and listen 3030 in the second?

  • I know what you mean.... I just want to know how can nginx rediret to different upstream eg. a.xxx.com goto app1 b.xxx.com goto app2

  • upstream app {
        # Path to Puma SOCK file, as defined previously
        server unix:/home/deploy/appname/shared/sockets/puma.sock fail_timeout=0;
    }
    

    I imitate a tutorial like this. When I multi my upstream and access public ip, how can nginx rediret to different apps?

  • 太神了,你说的没错,看来我对 turbolinks 了解的太少 qaq

  • 你是指内存免费乘 2 那个么?那个需要手动配置一下就好了

  • 大一狗看的心花怒放 😉 十分适合初学者理解 dijkstra 算法工作流程的文章!

    还有以下一个小错误?10 是不是改成 100

    假设从 S 到 U 的距离是 10,那么计算前 99 个哑节点的距离,都是没有意义的。

  • #1 楼 @flowerwrong Thank you very much! It did work! I can't even find solution on stackoverflow.😉

  • #19 楼 @adamshen 谢谢你,现在我已经知道自己错在哪里了。其实我运行 precompile 了,assets.rb 里面该加的也加了。只是我的服务器是 nginx,需要设置:

    config.serve_static_assets = false
    

    因为 jquery 这些 js 理论上是不用单独进行预编译的,我也很奇怪为什么浏览器会报错但是网页 js 加载的好好的......

  • #17 楼 @adamshen 在开发环境下这些 css,js 都不会出现 404 的情况,毕竟我也没有使用 assets pipeline 但是在生产环境下,一些 gem 里配有的 css,js 就算我在 application.js/css 文件中 require 它们,会报错但不会影响网站 js/css 实现 比如: jquery-0ed465fbecf04ae913ca41ffdb083e24.js?body=1 GET 404 script (index):7 0 B 305 ms
    jquery_ujs-90e9e71c91e43e7dad56d420bfb0f0c3.js?body=1 GET 404 script (index):8 0 B 829 ms
    jquery.turbolinks-bf4145241a1f3c33ca16fcd46ca39409.js?body=1 GET 404 script (index):9 0 B 909 ms
    turbolinks-3c4430349c04dd08ce7d3819bb2e7064.js?body=1 GET 404 script (index):10 0 B 909 ms
    nprogress-265ad313635e9ccba89a71ddb330936e.js?body=1 GET 404 script (index):11 0 B 973 ms
    nprogress-turbolinks-f33e6cee88a5842ce94cdf138ec989f2.js?body=1 GET 404 script (index):12 0 B 995 ms
    这些都是 gem 提供的 js,它们能发挥作用,但是会在加载的时候报错 404,使网站访问变慢 我怀疑它们已经进入 application.js 里面了,所以功能可以实现,但是为什么会找不到呢?

  • #4 楼 @1c7 抱歉回的晚了。用的是 linode,第二次 2800ms 即可,第一次卡一分钟

  • #13 楼 @hww 我知道,我已经加进去了,但是我想问一下为什么要加进去? 因为我已经把 home.js 放在 assets/javascripts/文件夹下了

  • 明白了,那我目前不打算再用 cap 了。我想问一下: = javascript_include_tag "home", "data-turbolinks-track" => true 这段代码写出来后,为何我再 application require 了 home 依然报错 提示是: Rails.application.config.assets.precompile += %w( home.js ) 必须要这么做么? 还有我有些晕,application.js 的生成不是把所有的 js 合并成 application-指纹.js 了么? 那为何还会有 home-指纹.js jquery-指纹.js 这些东西呢?