Devise Login在Localhost上工作,但不在Production上工作

乔治·凯弗伯克

我面临一个使我发疯的问题-主要是因为没有日志或错误消息,而且它可以在localhost上运行,但不适用于生产环境。

问题:

我进入登录页面-输入凭据(正确100%),然后单击登录按钮。未登录,没有消息,没有日志条目,未登录。它可以在localhost上按预期工作。

尽管我正在使用配置,但我无能为力,我希望其他人能够解决此问题并能够解决该问题。

Ubuntu版本:

发行者ID:Ubuntu说明:Ubuntu 14.04.3 LTS版本:14.04代号:trusty

Rails版本:

Rails 5.0.1

Ruby版本:

ruby 2.4.0p0(2016-12-24修订版57164)[x86_64-linux]

设计版本:

设计(4.2.0)

Nginx版本:

nginx版本:nginx / 1.10.2

乘客版本:

Phusion乘客5.1.2

生产日志:

    I, [2017-02-19T16:42:34.671850 #12709]  INFO -- : [2c7d1cea-31d4-414f-a3bf-0ca1f0434a66] Processing by StaticPagesController#teaser as HTML
I, [2017-02-19T16:42:34.672014 #12709]  INFO -- : [2c7d1cea-31d4-414f-a3bf-0ca1f0434a66]   Parameters: {"locale"=>"en"}
I, [2017-02-19T16:42:34.678782 #12709]  INFO -- : [2c7d1cea-31d4-414f-a3bf-0ca1f0434a66]   Rendering static_pages/teaser.html.haml within layouts/teaser
I, [2017-02-19T16:42:34.719835 #12709]  INFO -- : [2c7d1cea-31d4-414f-a3bf-0ca1f0434a66]   Rendered static_pages/teaser.html.haml within layouts/teaser (40.8ms)
I, [2017-02-19T16:42:34.729883 #12709]  INFO -- : [2c7d1cea-31d4-414f-a3bf-0ca1f0434a66]   Rendered layouts/tracking/_google_analytics.html.haml (1.7ms)
I, [2017-02-19T16:42:34.737139 #12709]  INFO -- : [2c7d1cea-31d4-414f-a3bf-0ca1f0434a66]   Rendered layouts/navs/_navigation_teaser.html.haml (6.4ms)
I, [2017-02-19T16:42:34.740481 #12709]  INFO -- : [2c7d1cea-31d4-414f-a3bf-0ca1f0434a66]   Rendered layouts/footers/_bottom.html.haml (2.4ms)
I, [2017-02-19T16:42:34.741421 #12709]  INFO -- : [2c7d1cea-31d4-414f-a3bf-0ca1f0434a66] Completed 200 OK in 69ms (Views: 66.8ms)
D, [2017-02-19T16:42:34.743712 #12709] DEBUG -- : [2c7d1cea-31d4-414f-a3bf-0ca1f0434a66] DEBUG: Chewy strategies stack: [2] -> atomic @ /usr/local/lib/ruby/gems/2.4.0/gems/chewy-0.9.0/lib/chewy/railtie.rb:17
I, [2017-02-19T16:42:38.140233 #12709]  INFO -- : [efa8a6ab-c0a9-40c5-ad5c-efc5fea35ff2] Started GET "/en/users/login/" for 213.225.34.85 at 2017-02-19 16:42:38 +0100
D, [2017-02-19T16:42:38.140679 #12709] DEBUG -- : [efa8a6ab-c0a9-40c5-ad5c-efc5fea35ff2] DEBUG: Chewy strategies stack: [2] <- atomic @ /usr/local/lib/ruby/gems/2.4.0/gems/chewy-0.9.0/lib/chewy/railtie.rb:17
I, [2017-02-19T16:42:38.143560 #12709]  INFO -- : [efa8a6ab-c0a9-40c5-ad5c-efc5fea35ff2] Processing by Devise::SessionsController#new as HTML
I, [2017-02-19T16:42:38.143632 #12709]  INFO -- : [efa8a6ab-c0a9-40c5-ad5c-efc5fea35ff2]   Parameters: {"locale"=>"en"}
I, [2017-02-19T16:42:38.181675 #12709]  INFO -- : [efa8a6ab-c0a9-40c5-ad5c-efc5fea35ff2]   Rendering devise/sessions/new.html.haml within layouts/devise
I, [2017-02-19T16:42:38.189833 #12709]  INFO -- : [efa8a6ab-c0a9-40c5-ad5c-efc5fea35ff2]   Rendered devise/sessions/new.html.haml within layouts/devise (8.0ms)
I, [2017-02-19T16:42:38.196498 #12709]  INFO -- : [efa8a6ab-c0a9-40c5-ad5c-efc5fea35ff2]   Rendered layouts/tracking/_google_analytics.html.haml (0.3ms)
I, [2017-02-19T16:42:38.199537 #12709]  INFO -- : [efa8a6ab-c0a9-40c5-ad5c-efc5fea35ff2]   Rendered layouts/_error_messages.html.haml (2.2ms)
I, [2017-02-19T16:42:38.201012 #12709]  INFO -- : [efa8a6ab-c0a9-40c5-ad5c-efc5fea35ff2]   Rendered layouts/footers/_bottom_devise.html.haml (0.8ms)
I, [2017-02-19T16:42:38.201777 #12709]  INFO -- : [efa8a6ab-c0a9-40c5-ad5c-efc5fea35ff2] Completed 200 OK in 58ms (Views: 23.5ms | ActiveRecord: 2.2ms)
D, [2017-02-19T16:42:38.202966 #12709] DEBUG -- : [efa8a6ab-c0a9-40c5-ad5c-efc5fea35ff2] DEBUG: Chewy strategies stack: [2] -> atomic @ /usr/local/lib/ruby/gems/2.4.0/gems/chewy-0.9.0/lib/chewy/railtie.rb:17
I, [2017-02-19T16:42:42.616812 #12709]  INFO -- : [3d15563f-bb6c-4a4e-84b4-46e473e237be] Started GET "/en/users/login/" for 213.225.34.85 at 2017-02-19 16:42:42 +0100
D, [2017-02-19T16:42:42.617237 #12709] DEBUG -- : [3d15563f-bb6c-4a4e-84b4-46e473e237be] DEBUG: Chewy strategies stack: [2] <- atomic @ /usr/local/lib/ruby/gems/2.4.0/gems/chewy-0.9.0/lib/chewy/railtie.rb:17
I, [2017-02-19T16:42:42.618504 #12709]  INFO -- : [3d15563f-bb6c-4a4e-84b4-46e473e237be] Processing by Devise::SessionsController#new as HTML
I, [2017-02-19T16:42:42.618574 #12709]  INFO -- : [3d15563f-bb6c-4a4e-84b4-46e473e237be]   Parameters: {"locale"=>"en"}
I, [2017-02-19T16:42:42.620779 #12709]  INFO -- : [3d15563f-bb6c-4a4e-84b4-46e473e237be]   Rendering devise/sessions/new.html.haml within layouts/devise
I, [2017-02-19T16:42:42.622348 #12709]  INFO -- : [3d15563f-bb6c-4a4e-84b4-46e473e237be]   Rendered devise/sessions/new.html.haml within layouts/devise (1.5ms)
I, [2017-02-19T16:42:42.624039 #12709]  INFO -- : [3d15563f-bb6c-4a4e-84b4-46e473e237be]   Rendered layouts/tracking/_google_analytics.html.haml (0.3ms)
I, [2017-02-19T16:42:42.624547 #12709]  INFO -- : [3d15563f-bb6c-4a4e-84b4-46e473e237be]   Rendered layouts/_error_messages.html.haml (0.2ms)
I, [2017-02-19T16:42:42.624961 #12709]  INFO -- : [3d15563f-bb6c-4a4e-84b4-46e473e237be]   Rendered layouts/footers/_bottom_devise.html.haml (0.2ms)
I, [2017-02-19T16:42:42.625530 #12709]  INFO -- : [3d15563f-bb6c-4a4e-84b4-46e473e237be] Completed 200 OK in 7ms (Views: 5.0ms | ActiveRecord: 0.0ms)
D, [2017-02-19T16:42:42.626717 #12709] DEBUG -- : [3d15563f-bb6c-4a4e-84b4-46e473e237be] DEBUG: Chewy strategies stack: [2] -> atomic @ /usr/local/lib/ruby/gems/2.4.0/gems/chewy-0.9.0/lib/chewy/railtie.rb:17

Nginx日志(error.log):

[ 2017-02-19 16:39:22.3744 11673/7fbd8cdd47c0 age/Ust/UstRouterMain.cpp:492 ]: Received command to shutdown gracefully. Waiting until all clients have disconnected...
[ 2017-02-19 16:39:22.3744 11673/7fbd85dca700 Ser/Server.h:817 ]: [UstRouterApiServer] Freed 0 spare client objects
[ 2017-02-19 16:39:22.3745 11673/7fbd85dca700 Ser/Server.h:464 ]: [UstRouterApiServer] Shutdown finished
[ 2017-02-19 16:39:22.3747 11673/7fbd865cb700 Ser/Server.h:464 ]: [UstRouter] Shutdown finished
[ 2017-02-19 16:39:22.3748 11673/7fbd8cdd47c0 age/Ust/UstRouterMain.cpp:523 ]: Passenger UstRouter shutdown finished
[ 2017-02-19 16:39:22.6189 11663/7f5c6c8fe7c0 age/Cor/CoreMain.cpp:1055 ]: Passenger core shutdown finished
[ 2017-02-19 16:39:23.4450 12221/7fbf2251a7c0 age/Wat/WatchdogMain.cpp:1281 ]: Starting Passenger watchdog...
[ 2017-02-19 16:39:23.4539 12224/7f409d5e37c0 age/Cor/CoreMain.cpp:1070 ]: Starting Passenger core...
[ 2017-02-19 16:39:23.4541 12224/7f409d5e37c0 age/Cor/CoreMain.cpp:245 ]: Passenger core running in multi-application mode.
[ 2017-02-19 16:39:23.4585 12224/7f409d5e37c0 age/Cor/CoreMain.cpp:820 ]: Passenger core online, PID 12224
[ 2017-02-19 16:39:23.4675 12230/7f8a2efc77c0 age/Ust/UstRouterMain.cpp:529 ]: Starting Passenger UstRouter...
[ 2017-02-19 16:39:23.4685 12230/7f8a2efc77c0 age/Ust/UstRouterMain.cpp:342 ]: Passenger UstRouter online, PID 12230
[ 2017-02-19 16:39:25.6619 12224/7f409d4cb700 age/Cor/SecurityUpdateChecker.h:464 ]: Security update check: no update found (next check in 24 hours)
App 12257 stdout: 
App 12382 stdout: 
2017/02/19 16:42:21 [info] 12537#12537: Using 32768KiB of shared memory for nchan in /etc/nginx/nginx.conf:74

[ 2017-02-19 16:42:21.7235 12224/7f4096e14700 age/Cor/CoreMain.cpp:585 ]: Signal received. Gracefully shutting down... (send signal 2 more time(s) to force shutdown)
[ 2017-02-19 16:42:21.7236 12224/7f409d5e37c0 age/Cor/CoreMain.cpp:989 ]: Received command to shutdown gracefully. Waiting until all clients have disconnected...
[ 2017-02-19 16:42:21.7236 12224/7f409d5e37c0 age/Cor/CoreMain.cpp:907 ]: Checking whether to disconnect long-running connections for process 12382, application /home/sandbox/rails/windhagermediahub/public (production)
[ 2017-02-19 16:42:21.7239 12224/7f4096592700 Ser/Server.h:817 ]: [ServerThr.2] Freed 128 spare client objects
[ 2017-02-19 16:42:21.7239 12224/7f4096592700 Ser/Server.h:464 ]: [ServerThr.2] Shutdown finished
[ 2017-02-19 16:42:21.7242 12224/7f4096e14700 Ser/Server.h:817 ]: [ServerThr.1] Freed 128 spare client objects
[ 2017-02-19 16:42:21.7242 12224/7f4096e14700 Ser/Server.h:464 ]: [ServerThr.1] Shutdown finished
[ 2017-02-19 16:42:21.7243 12224/7f4095d10700 Ser/Server.h:817 ]: [ApiServer] Freed 0 spare client objects
[ 2017-02-19 16:42:21.7243 12224/7f4095d10700 Ser/Server.h:464 ]: [ApiServer] Shutdown finished
[ 2017-02-19 16:42:21.7244 12224/7f409d5e37c0 age/Cor/CoreMain.cpp:907 ]: Checking whether to disconnect long-running connections for process 12382, application /home/sandbox/rails/windhagermediahub/public (production)

[ 2017-02-19 16:42:21.7265 12230/7f8a23fff700 age/Ust/UstRouterMain.cpp:422 ]: Signal received. Gracefully shutting down... (send signal 2 more time(s) to force shutdown)
[ 2017-02-19 16:42:21.7266 12230/7f8a2efc77c0 age/Ust/UstRouterMain.cpp:492 ]: Received command to shutdown gracefully. Waiting until all clients have disconnected...
[ 2017-02-19 16:42:21.7266 12230/7f8a237fe700 Ser/Server.h:817 ]: [UstRouterApiServer] Freed 0 spare client objects
[ 2017-02-19 16:42:21.7266 12230/7f8a237fe700 Ser/Server.h:464 ]: [UstRouterApiServer] Shutdown finished
[ 2017-02-19 16:42:21.7268 12230/7f8a23fff700 Ser/Server.h:464 ]: [UstRouter] Shutdown finished
[ 2017-02-19 16:42:21.7272 12230/7f8a2efc77c0 age/Ust/UstRouterMain.cpp:523 ]: Passenger UstRouter shutdown finished
[ 2017-02-19 16:42:21.9690 12224/7f409d5e37c0 age/Cor/CoreMain.cpp:1055 ]: Passenger core shutdown finished
[ 2017-02-19 16:42:22.7904 12548/7f4dcba4d7c0 age/Wat/WatchdogMain.cpp:1281 ]: Starting Passenger watchdog...
[ 2017-02-19 16:42:22.8003 12551/7f388a8967c0 age/Cor/CoreMain.cpp:1070 ]: Starting Passenger core...
[ 2017-02-19 16:42:22.8005 12551/7f388a8967c0 age/Cor/CoreMain.cpp:245 ]: Passenger core running in multi-application mode.
[ 2017-02-19 16:42:22.8053 12551/7f388a8967c0 age/Cor/CoreMain.cpp:820 ]: Passenger core online, PID 12551
[ 2017-02-19 16:42:22.8155 12557/7fd30e4537c0 age/Ust/UstRouterMain.cpp:529 ]: Starting Passenger UstRouter...
[ 2017-02-19 16:42:22.8165 12557/7fd30e4537c0 age/Ust/UstRouterMain.cpp:342 ]: Passenger UstRouter online, PID 12557
[ 2017-02-19 16:42:24.9877 12551/7f388a77e700 age/Cor/SecurityUpdateChecker.h:464 ]: Security update check: no update found (next check in 24 hours)
App 12582 stdout: 
App 12709 stdout: 

更新:

用Clearance替换devise之后,问题仍然存在。根据日志,它正在尝试发出GET请求,而该请求应该是POST。该表单可在localhost上运行,并且一切看起来正确。我什至在登录表单中指定了该方法,但它仍在发出GET。我在这里咬灰尘。

UPDATE2:

我完全删除了Devise以及代码中对它的所有引用,然后再次进行了设置-没有对Devise进行任何修改或自定义。正在使用标准视图和表格。

登录表单(会话新)

<h2>Log in</h2>

<%= simple_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
  <div class="form-inputs">
    <%= f.input :email, required: false, autofocus: true %>
    <%= f.input :password, required: false %>
    <%= f.input :remember_me, as: :boolean if devise_mapping.rememberable? %>
  </div>

  <div class="form-actions">
    <%= f.button :submit, "Log in" %>
  </div>
<% end %>

<%= render "devise/shared/links" %>

更新3

routes.rb

Rails.application.routes.draw do

  # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
  root to: 'static_pages#redirect'

  localized do

    match '', to: 'static_pages#teaser', :as => 'teaser', via: 'get'
    scope 'legal' do
      match 'data-privacy',    to: 'static_pages#data_privacy', :as => 'data-privacy',    via: 'get'
      match 'terms-of-use',    to: 'static_pages#terms_of_use', :as => 'terms_of_use',    via: 'get'
      match 'cookie-policy',    to: 'static_pages#cookie_policy', :as => 'cookie_policy',    via: 'get'
    end

    devise_for :users, :path_names => {:sign_in => 'login', :sign_out => 'logout'}



    scope 'dashboard' do
      match 'wh-a-seo-at', to: 'dashboards#seo_at', :as => 'dashboard_seo_at', via: 'get'
      match 'wh-a-seo-de', to: 'dashboards#seo_de', :as => 'dashboard_seo_de', via: 'get'
      match 'wh-a-uiux', to: 'dashboards#uiux', :as => 'dashboard_uiux', via: 'get'
      resources :links
      resources :key_performance_indicators
      resources :keyword_lists do
        resources :keyword_dates
        resources :keyword_groups do
          resources :keywords do
            resources :keyword_rankings
          end
        end
      end
    end
  end
end

输出:RAILS_ENV =生产包执行耙

georg$ RAILS_ENV=production bundle exec rake routes
                                                    Prefix Verb   URI Pattern                                                                                                                            Controller#Action
                                                      root GET    /                                                                                                                                      static_pages#redirect
                                                 teaser_en GET    /en                                                                                                                                    static_pages#teaser {:locale=>"en"}
                                           data_privacy_en GET    /en/legal/data-privacy(.:format)                                                                                                       static_pages#data_privacy {:locale=>"en"}
                                           terms_of_use_en GET    /en/legal/terms-of-use(.:format)                                                                                                       static_pages#terms_of_use {:locale=>"en"}
                                          cookie_policy_en GET    /en/legal/cookie-policy(.:format)                                                                                                      static_pages#cookie_policy {:locale=>"en"}
                                       new_user_session_en GET    /en/users/login(.:format)                                                                                                              devise/sessions#new {:locale=>"en"}
                                           user_session_en POST   /en/users/login(.:format)                                                                                                              devise/sessions#create {:locale=>"en"}
                                   destroy_user_session_en DELETE /en/users/logout(.:format)                                                                                                             devise/sessions#destroy {:locale=>"en"}

etc.

production.rb

Rails.application.configure do
  # Settings specified here will take precedence over those in config/application.rb.

  # Code is not reloaded between requests.
  config.cache_classes = true

  # Eager load code on boot. This eager loads most of Rails and
  # your application in memory, allowing both threaded web servers
  # and those relying on copy on write to perform better.
  # Rake tasks automatically ignore this option for performance.
  config.eager_load = true

  # Full error reports are disabled and caching is turned on.
  config.consider_all_requests_local       = false
  config.action_controller.perform_caching = true

  # Disable serving static files from the `/public` folder by default since
  # Apache or NGINX already handles this.
  config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?

  # Compress JavaScripts and CSS.
  config.assets.js_compressor = :uglifier
  # config.assets.css_compressor = :sass

  # Do not fallback to assets pipeline if a precompiled asset is missed.
  config.assets.compile = false

  # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb

  # Enable serving of images, stylesheets, and JavaScripts from an asset server.
  # config.action_controller.asset_host = 'http://assets.example.com'

  # Specifies the header that your server uses for sending files.
  # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
  # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX

  # Mount Action Cable outside main process or domain
  # config.action_cable.mount_path = nil
  # config.action_cable.url = 'wss://example.com/cable'
  # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]

  # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
  # config.force_ssl = true

  # Use the lowest log level to ensure availability of diagnostic information
  # when problems arise.
  config.log_level = :debug

  # Prepend all log lines with the following tags.
  config.log_tags = [ :request_id ]

  # Use a different cache store in production.
  # config.cache_store = :mem_cache_store

  # Use a real queuing backend for Active Job (and separate queues per environment)
  # config.active_job.queue_adapter     = :resque
  # config.active_job.queue_name_prefix = "PRODEV0007_#{Rails.env}"
  config.action_mailer.perform_caching = false

  # Ignore bad email addresses and do not raise email delivery errors.
  # Set this to true and configure the email server for immediate delivery to raise delivery errors.
  # config.action_mailer.raise_delivery_errors = false

  # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
  # the I18n.default_locale when a translation cannot be found).
  config.i18n.fallbacks = true

  # Send deprecation notices to registered listeners.
  config.active_support.deprecation = :notify

  # Use default logging formatter so that PID and timestamp are not suppressed.
  config.log_formatter = ::Logger::Formatter.new

  # Use a different logger for distributed setups.
  # require 'syslog/logger'
  # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')

  if ENV["RAILS_LOG_TO_STDOUT"].present?
    logger           = ActiveSupport::Logger.new(STDOUT)
    logger.formatter = config.log_formatter
    config.logger = ActiveSupport::TaggedLogging.new(logger)
  end

  config.active_record.dump_schema_after_migration = false

  config.assets.precompile += %w(*.png *.jpg *.jpeg *.gif *.svg application_split2.css )

  # Tested force_ssl with true and false
  config.force_ssl = true

  config.i18n.fallbacks = true
end

表格的格式化版本

<form novalidate="novalidate" class="simple_form new_user" id="new_user" action="/en/users/login" accept-charset="UTF-8" method="post"><input name="utf8" type="hidden" value="✓"><input type="hidden" name="authenticity_token" value="R5dzqGlWWGhP5UD6QvR9TEZatNgot8UYtfOwQbQO+Ksv7DEgoVNDL/LSk7cRcZsxUSHnn8T/XQLkDr9B+y0weQ==">
        <div class="form-inputs">
          <div class="input email optional user_email"><label class="email optional" for="user_email">Email</label><input class="string email optional" autofocus="autofocus" type="email" value="" name="user[email]" id="user_email"></div>
          <div class="input password optional user_password"><label class="password optional" for="user_password">Password</label><input class="password optional" type="password" name="user[password]" id="user_password"></div>
          <div class="input boolean optional user_remember_me"><input value="0" type="hidden" name="user[remember_me]"><label class="boolean optional checkbox" for="user_remember_me"><input class="boolean optional" type="checkbox" value="1" name="user[remember_me]" id="user_remember_me">Remember me</label></div>
        </div>

        <div class="form-actions">
          <input type="submit" name="commit" value="Log in" class="btn" data-disable-with="Log in">
        </div>
      </form>

user.rb

class User < ApplicationRecord
  #include Clearance::User

  extend FriendlyId
  friendly_id :slug_candidates, use: :slugged

  # Include default devise modules. Others available are:
  # :confirmable, :lockable, :timeoutable and :omniauthable
  devise :database_authenticatable, :rememberable, :trackable


  private
    def slug_candidates
      [
          SecureRandom.hex(4).to_s + "-" + self.email[/[^@]+/]
      ]
    end
end

更新4

有关完整的HTML标记-请参见

这里

这是正在产生的形式。

layouts / devise.html.haml

!!! 5
%html
  %head
    %meta{:charset => "utf-8"}
    %title= title
    = csrf_meta_tags

    %script{:src => "https://use.fontawesome.com/89c3729707.js"}

    %meta{:name => "viewport", :content => "width=device-width, initial-scale=1.0"}

    %meta{:name => "viewport", :content => "width=device-width, initial-scale=1, maximum-scale=1"}
    %meta{:name => "description", :content => "#{meta_description}"}


    / Le HTML5 shim, for IE6-8 support of HTML elements
    /[if lt IE 9]
      %script{:src => "http://html5shim.googlecode.com/svn/trunk/html5.js", :type => "text/javascript"}

    / Le styles
    = stylesheet_link_tag "application", :media => "all", :"data-turbolinks" => false
    = javascript_include_tag "//cdnjs.cloudflare.com/ajax/libs/modernizr/2.8.3/modernizr.min.js"
    = javascript_include_tag "application", :"data-turbolinks" => false
    / Le fav and touch icons
    = favicon_link_tag
    = render 'layouts/tracking/google_analytics'
  %body.home
    %div.home_overlay
    /= cookie_law!
    = render "layouts/navs/navigation_teaser"
    = yield
    - if params[:action] == "teaser" && !user_signed_in?
      = render "layouts/footers/bottom"

更新6

问题是我的nginx配置。可行的方法如下:

server {
  listen 80;
  server_name win-marketing.sciencesupercrew.com www.win-marketing.sciencesupercrew.com;
  return 301 https://www.win-marketing.sciencesupercrew.com$request_uri;
}

server {
  listen 443 ssl;
  server_name win-marketing.sciencesupercrew.com; 

  passenger_enabled on;
  rails_env production;
  root /home/demo/windhagermediahub/public;

  ssl on;

  ssl_certificate      /home/demo/ssl/ssl-bundle.crt;
  ssl_certificate_key  /home/demo/ssl/ssc.key;

  ssl_session_timeout  5m;

  ssl_protocols  SSLv2 SSLv3 TLSv1;
  ssl_ciphers  HIGH:!aNULL:!MD5;
  ssl_prefer_server_ciphers   on;

  location ^~ /assets/ {
    gzip_static on;
    expires max;
    add_header Cache-Control public;
  }

  error_page 500 502 503 504 /500.html;
  client_max_body_size 4G;
  keepalive_timeout 10;
}

添加这些行后,它开始工作:

  ssl_session_timeout  5m;

  ssl_protocols  SSLv2 SSLv3 TLSv1;
  ssl_ciphers  HIGH:!aNULL:!MD5;
  ssl_prefer_server_ciphers   on;
ka

恭喜你弄明白了!在下面发布我的最后评论作为答案。

感谢您的现场示例。因此,我单击了提交按钮,我可以看到浏览器正在发送POST请求。服务器成功响应,但带有重定向。POST https://win-marketing.sciencesupercrew.com/en/users/login-> 301 Moved Permanently with Location: https://win-marketing.sciencesupercrew.com/en/users/login/表单数据按user[email]正确发送user[password]

如果您说此请求未到达Rails,则需要检查您的nginx配置。

更新的解决方案

问题是我的nginx配置。可行的方法如下:

server {
  listen 80;
  server_name win-marketing.sciencesupercrew.com www.win-marketing.sciencesupercrew.com;
  return 301 https://www.win-marketing.sciencesupercrew.com$request_uri;
}

server {
  listen 443 ssl;
  server_name win-marketing.sciencesupercrew.com; 

  passenger_enabled on;
  rails_env production;
  root /home/demo/windhagermediahub/public;

  ssl on;

  ssl_certificate      /home/demo/ssl/ssl-bundle.crt;
  ssl_certificate_key  /home/demo/ssl/ssc.key;

  ssl_session_timeout  5m;

  ssl_protocols  SSLv2 SSLv3 TLSv1;
  ssl_ciphers  HIGH:!aNULL:!MD5;
  ssl_prefer_server_ciphers   on;

  location ^~ /assets/ {
    gzip_static on;
    expires max;
    add_header Cache-Control public;
  }

  error_page 500 502 503 504 /500.html;
  client_max_body_size 4G;
  keepalive_timeout 10;
}

添加这些行后,它开始工作:

  ssl_session_timeout  5m;

  ssl_protocols  SSLv2 SSLv3 TLSv1;
  ssl_ciphers  HIGH:!aNULL:!MD5;
  ssl_prefer_server_ciphers   on;

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

在JSFiddle上工作,但不在本地工作?

来自分类Dev

在JSFiddle上工作,但不在本地工作?

来自分类Dev

Rails ActiveAdmin 不在 Heroku 上工作,但在 Localhost 上工作

来自分类Dev

Retrofit 2 在 Postman 和 Localhost 中工作,但不在 Amazon AWS Live Server 上工作

来自分类Dev

Font Awesome在本地工作,但不在Heroku上工作

来自分类Dev

CSS 和 JS 在 localhost 上工作,但不在 Heroku Webserver 上

来自分类Dev

OSG:GLSL Shader在AMD上工作,但不在NVIDIA上工作

来自分类Dev

SVM正在R中的训练集上工作,但不在R中的测试集上工作

来自分类Dev

Apache 2.4 + Codeigniter Urls在HTTP上工作,但不在HTTPS上工作

来自分类Dev

引导轮播-在bootply上工作,但不在站点上工作

来自分类Dev

Bootstrap在本地主机上工作,但不在联机服务器上工作

来自分类Dev

WebService Post在模拟器上工作,但不在设备上工作

来自分类Dev

CSS类在一页上工作,但不在另一页上工作

来自分类Dev

AJAX postdata 在本地主机上工作但不在(Apache)服务器上工作

来自分类Dev

在 mac 上工作但不在机器上工作 - linux ubuntu - 节点服务器

来自分类Dev

javascript 在本地服务器上工作,但不在实时服务器 2 上工作

来自分类Dev

以编程方式安装 Composer 在 vagrant 上工作但不在 EC2 实例上工作

来自分类Dev

Jquery 在控制台上工作但不在页面上

来自分类Dev

Butterknife不在片段上工作

来自分类Dev

form_for in devise如何工作?

来自分类Dev

WP查询循环通过在主页上工作但不在搜索页面上工作的自定义帖子类型

来自分类Dev

使用CORS的LocomotiveJs的Rest API。在本地计算机上工作,但不在Amazon或Heroku上工作

来自分类Dev

WP查询循环通过在主页上工作但不在搜索页面上工作的自定义帖子类型

来自分类Dev

“插入不存在的地方” - 在本地 (5.6.35) 上工作但不在服务器 (5.7.22) 上工作 - 未显示错误

来自分类Dev

RichTextBox 在本地服务器上工作,但不在 Azure Web API 服务器上工作

来自分类Dev

rm在命令行上工作,但不在脚本中工作

来自分类Dev

alignParentBottom在模拟器中工作,但不在设备上工作

来自分类Dev

rm在命令行上工作,但不在脚本中工作

来自分类Dev

ASP.Net LinkButton在本地工作,但不在服务器上工作

Related 相关文章

  1. 1

    在JSFiddle上工作,但不在本地工作?

  2. 2

    在JSFiddle上工作,但不在本地工作?

  3. 3

    Rails ActiveAdmin 不在 Heroku 上工作,但在 Localhost 上工作

  4. 4

    Retrofit 2 在 Postman 和 Localhost 中工作,但不在 Amazon AWS Live Server 上工作

  5. 5

    Font Awesome在本地工作,但不在Heroku上工作

  6. 6

    CSS 和 JS 在 localhost 上工作,但不在 Heroku Webserver 上

  7. 7

    OSG:GLSL Shader在AMD上工作,但不在NVIDIA上工作

  8. 8

    SVM正在R中的训练集上工作,但不在R中的测试集上工作

  9. 9

    Apache 2.4 + Codeigniter Urls在HTTP上工作,但不在HTTPS上工作

  10. 10

    引导轮播-在bootply上工作,但不在站点上工作

  11. 11

    Bootstrap在本地主机上工作,但不在联机服务器上工作

  12. 12

    WebService Post在模拟器上工作,但不在设备上工作

  13. 13

    CSS类在一页上工作,但不在另一页上工作

  14. 14

    AJAX postdata 在本地主机上工作但不在(Apache)服务器上工作

  15. 15

    在 mac 上工作但不在机器上工作 - linux ubuntu - 节点服务器

  16. 16

    javascript 在本地服务器上工作,但不在实时服务器 2 上工作

  17. 17

    以编程方式安装 Composer 在 vagrant 上工作但不在 EC2 实例上工作

  18. 18

    Jquery 在控制台上工作但不在页面上

  19. 19

    Butterknife不在片段上工作

  20. 20

    form_for in devise如何工作?

  21. 21

    WP查询循环通过在主页上工作但不在搜索页面上工作的自定义帖子类型

  22. 22

    使用CORS的LocomotiveJs的Rest API。在本地计算机上工作,但不在Amazon或Heroku上工作

  23. 23

    WP查询循环通过在主页上工作但不在搜索页面上工作的自定义帖子类型

  24. 24

    “插入不存在的地方” - 在本地 (5.6.35) 上工作但不在服务器 (5.7.22) 上工作 - 未显示错误

  25. 25

    RichTextBox 在本地服务器上工作,但不在 Azure Web API 服务器上工作

  26. 26

    rm在命令行上工作,但不在脚本中工作

  27. 27

    alignParentBottom在模拟器中工作,但不在设备上工作

  28. 28

    rm在命令行上工作,但不在脚本中工作

  29. 29

    ASP.Net LinkButton在本地工作,但不在服务器上工作

热门标签

归档