font-awesome 无法显示在 Nginx、Rails 4、mina/puma 上

font-awesome 无法显示在 Nginx、Rails 4、mina/puma 上

我对 nginx 配置文件进行了一些更改,现在我在 FF 和 Chrome 上看不到任何 font-awesome 字体。字体已预编译并位于此目录中:/root/sites/mina_deploy/current/public/assets

当我 Curl 网站时,我得到:

HTTP/1.1 200 OK
Server: nginx
Date: Mon, 20 Jul 2015 23:49:09 GMT
Content-Type: text/html; charset=utf-8
Connection: keep-alive
Strict-Transport-Security: max-age=31536000
ETag: W/"0c75edc92c62c5d46186bfb0620f7a27"
Cache-Control: max-age=0, private, must-revalidate
Set-Cookie: request_method=HEAD; path=/; secure
Set-Cookie: _whoteaches-mongo_session=ir1NKco3GyOKqfMi9qBz1yK_InQ; path=/; secure; HttpOnly
X-Request-Id: e1b7b4ae-e364-48d4-ba13-5659f293d118
X-Runtime: 0.062513
Strict-Transport-Security: max-age=63072000
Access-Control-Allow-Origin: *
X-Content-Type-Options: nosniff

如您所见,标题中存在“Access-Control-Allow-Origin: *”。但是,我看不到这些字体。

以下是我的 nginx 配置文件。你能帮我找出发生了什么吗?

user root;
worker_processes 4;
pid /var/run/nginx.pid;
error_log  /var/log/nginx/error.log error;

events {
  worker_connections  1024;
  accept_mutex off;
  use epoll;
}


http {
  include /etc/nginx/mime.types;
  types_hash_max_size 2048;
  default_type application/octet-stream;
  #access_log /tmp/nginx.access.log combined;

  # use the kernel sendfile
  sendfile      on;
  # prepend http headers before sendfile() 
  tcp_nopush    on;

  keepalive_timeout  25;
  tcp_nodelay        on;

  gzip on;
  gzip_http_version 1.0;
  gzip_proxied any;
  gzip_min_length 500;
  gzip_disable "MSIE [1-6]\.";
  gzip_types text/plain text/html text/xml text/css
             text/comma-separated-values
             text/javascript application/x-javascript
             application/atom+xml;

  #Hide server info
  server_tokens off;

    upstream app_server {
      server unix:/root/sites/mina_deploy/shared/tmp/sockets/puma.sock
      fail_timeout=0;
    }

    server {
        listen 80;
        server_name www.domain.com;
        return 301 https://domain.com$request_uri;
    }
    server {
        listen 80;
        server_name domain.com;
        return 301 https://domain.com$request_uri;
    }
  server {
    server_name domain.com;
    root /root/sites/mina_deploy/current/public;
    listen 443 ssl;

    ssl_certificate    /etc/ssl/ssl-bundle.crt;
    ssl_certificate_key     /etc/ssl/myserver.key;
    #enables all versions of TLS, but not SSLv2 or 3 which are weak and now deprecated.
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    #Disables all weak ciphers
    ssl_ciphers 'AES128+EECDH:AES128+EDH';
    ssl_session_cache shared:SSL:10m;
    ssl_prefer_server_ciphers on;
    ssl_dhparam /etc/ssl/dhparam.pem;
    ssl_stapling on;
    ssl_stapling_verify on;
    # maximum accepted body size of client request 
    client_max_body_size 4G;
    # the server will close connections after this time 
    keepalive_timeout 5;

    add_header Strict-Transport-Security max-age=63072000;
    #add_header X-Frame-Options DENY;
    add_header Access-Control-Allow-Origin '*';
    add_header X-Content-Type-Options nosniff;

    resolver 8.8.8.8 8.8.4.4 valid=300s;
    resolver_timeout 5s;

    location ~ ^/(system|assets)/  {
      root /root/sites/mina_deploy/current/public;
      #gzip_static on;
      error_page 405 = $uri;
      expires max;
      #add_header Cache-Control public;
      break;
    } 

   try_files $uri/index.html $uri @app;

   location @app {
      # pass to the upstream unicorn server mentioned above 
      proxy_pass http://app_server;
      proxy_redirect off;

      proxy_set_header   Host              $host;
      proxy_set_header   X-Real-IP         $remote_addr;
      proxy_set_header   X-Forwarded-For   $proxy_add_x_forwarded_for;
      proxy_set_header   X-Forwarded-Proto $scheme;

      proxy_read_timeout 300;
     }
    }
    server {
      listen 443;
      server_name www.domain.com;
      return 301 https://domain.com$request_uri;
    }
}

相关内容