CentOS 7 Nginx(13:权限被拒绝),同时从CSS加载字体文件

我有一个带有bootstrap js框架的nginx webserver。 我正在试图让CSS能够加载字体文件。 虽然当浏览器试图访问字体文件时,我得到错误403。

我已经环顾serverfault那些有类似的问题,虽然我不成功应用他们的解决scheme。 例如:“ 我怎样才能让nginx支持@ font-face格式并允许访问控制允许来源?

以下是我的错误和我的服务器configuration:

错误:

2016/01/07 10:30:10 [error] 20770#0: *26 open() "/usr/share/nginx/html/fonts/glyphicons-halflings-regular.ttf" failed (13: Permission denied), client: 0.0.0.0, server: localhost, request: "GET /fonts/glyphicons-halflings-regular.ttf HTTP/1.1", host: "localhost", referrer: "http://localhost/css/bootstrap.min.css" 

/etc/nginx/conf.d/default.conf:

 server { listen 80; server_name localhost; #charset koi8-r; #access_log /var/log/nginx/log/host.access.log main; location / { root /usr/share/nginx/html; index index.html index.htm; if ($request_filename ~* ^.*?/([^/]*?)$) { set $filename $1; } if ($filename ~* ^.*?\.(eot)|(ttf)|(woff)$){ add_header Access-Control-Allow-Origin *; } } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # #location ~ \.php$ { # root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; # include fastcgi_params; #} location ~ \.php$ { root /usr/share/nginx/html; try_files $uri =404; fastcgi_pass unix:/var/run/php-fpm/php5-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # location ~ /\.ht { deny all; } } 

/etc/nginx/mime.types:

 application/vnd.ms-fontobject eot; application/font-sfnt otf ttf; application/font-woff woff; application/font-woff2 woff2; 

systemctl重启nginx.service

这是nginx无法打开文件(而不是nginx本身拒绝访问),请确保nginx的用户被允许阅读glyphicons-halflings.ttf