ruby  : 2.3.3
rails : 5.1.1
nginx  : 1.0.1
mysql :5.7
注明:我是按照 这个操作的 (http://web.siwei.tech/part3_rails_premier/rails_thin_deploy.html)
描述一下我的问题,配置了 nginx.conf 文件 rails 项目的地址 thin.yml 配置文件也写了 但是访问还是显示的 是 nginx 的欢迎页面:
# config/thim.yml
  chdir: /www/Mylog   # 你的rails 应用的所在目录
   environment: production    # 指定了 是 production模式
   address: 0.0.0.0
   port: 8000                 # 端口号。
   timeout: 30
   log: log/thin.log
   pid: tmp/pids/thin.pid
   max_conns: 1024
   max_persistent_conns: 100
   require: []
   wait: 30
   servers: 2          # 很重要。希望启动的thin 的进程数。
   daemonize: true
#    config/secrets.yml
  production模式下的字符串是随意加的
development:
  secret_key_base: e4122773d4324fce978c52cde790d84d14f7194f377aea41b7b8302d1d10150e6076a3b7e5e0c1f24ca330cf0a058482c9
 test:
   secret_key_base: e4122773d4324fce978c52cde790d84d14f7194f377aea41b7b8302d1d10150e6076a3b7e5e0c1f24ca330cf0a058482c9
  production:
    secret_key_base: a1b2c3d4a5d6e4122773d4324fce978c52cde790d84d14f7194f377aea41b7b8302d1d10150e60
#  confi/ database.yml
default: &default
   adapter: mysql2
    encoding: utf8
    pool: 5
    username: root
    password: youshe
   host: localhost
  development:
    <<: *default
    database: mylog_development
 test:
    <<: *default
    database: mylog_test
production:
   <<: *default
   database: mylog_development
   username: root
   password: youshe
#   config/environments/production.rb
Cms::Application.configure do
    # 不让 rails 来处理 /assets 开头的 url, 这些要交给nginx来处理.
    config.serve_static_assets = false
end
#   opt/nginx/nginx-1.0.10/conf/nginx.conf  (nginx 我是源码编译 安装在opt下面)
user  mandy;
worker_processes  1;
#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;
# pid        logs/nginx.pid;
events {
    worker_connections  1024;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';
    #access_log  logs/access.log  main;
    sendfile        on;
    #tcp_nopush     on;
    #keepalive_timeout  0;
    keepalive_timeout  65;
   #gzip  on;
    server {
        listen       80;
        server_name  athonna.com;
        charset utf-8;
        root  /www/Mylog/public/;
        access_log  logs/access.log;
        error_log  logs/error.log;
        location / {
             proxy_pass      http://athonna_servers;
             proxy_redirect      default;
             proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
             proxy_set_header    X-Real-IP $remote_addr;
             proxy_set_header    Host $http_host;
             proxy_next_upstream http_502 http_504 error timeout invalid_header;
         }
         #error_page  404              /404.html;
        # redirect server error pages to the static page /50x.html
        location ~ ^/assets/ {
          # 表示 处理这些请求的话,应该从哪个文件夹开始
          root  /www/Mylog/public/;
          expires 1y;
          add_header Cache-Control public;
          add_header ETag "";
          break;
        }
    }
我想问问 是哪里有问题呢 我使用 thin 的 development -p 8000 这么访问是没问题可以访问的
然后 换成 bundle exec thin start -p 8000 -e production 也可以访问 图片都能显示出来 ,但是在 config/environments/production.rb 中加了
#  config/environments/production.rb
Cms::Application.configure do
    # 不让 rails 来处理 /assets 开头的 url, 这些要交给nginx来处理.
    config.serve_static_assets = false
end
就不在显示 图片了 ,后面把这个注释掉 也还是不显示图片 css 这些