It took two weeks for Google to deploy the method. Many methods were useless. I finally used the control variable method to modify the configuration file one by one.
First,/etc/nginx/vhosts/limlog.sloger.info. conf and config/puma. rb
## /etc/nginx/vhosts/limlog.sloger.info.conf# upstream limlog { server unix:///tmp/limlog.sock;} server { listen 80; server_name limlog.sloger.info; root /srv/http/limlog.sloger.info/public; access_log /var/log/nginx/limlog-access.log; error_log /var/log/nginx/limlog-error.log info; location / { expires max; add_header Cache-Control public; proxy_redirect off; proxy_set_header Host $http_host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://limlog; } location ~ ^/assets/ { expires 1y; gzip_static on; add_header ETag ""; add_header Cache-Control public; break; }}
#!/usr/bin/env ruby -w ## config/puma.rb# rails_env = ENV['RAILS_ENV'] || 'development' threads 4, 4 bind 'unix:///tmp/limlog.sock'pidfile '/tmp/limlog.pid'state_path '/tmp/limlog.state' activate_control_app
Modify the root server_name upstream in the nginx configuration file to yours. Where is each file, and write it in the file header comment.
Then, modify config/environmens/production. rb.
Change "false" to "true" for 18 rows
# Disable Rails's static asset server (Apache or nginx will already do this).config.serve_static_assets = true
29 lines uncomment
# Specifies the header that your server uses for sending files.# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apacheconfig.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
Then the app/controller/application_controller
Line 2 parameter with: exception removed
protect_from_forgery
However, this is secret_key_base.
My approach is to create a file env. sh
# Use rake secret to generate the key, and paste it in the following format: =: export SECRET_KEY_BASE = # various environment variables can be export
Start
Start or restart nginx
Import the environment variable source env. sh
Start rails bundle exec-C config/puma. rb-e production
Now the deployment is complete, and the most troublesome assets are also solved ~