how to configure .htc files to work on nginx

2019-05-01 00:35发布

问题:

I'm trying to run rounded corners on <= IE8 using border-radius.htc located here. I've run the URL to the .htc file in my browser, and I can view the code so my path is correct in the css file. I'm using nginx to host my webpages.

Does anyone know how I can get this file to run so that the styling works in < IE9? I've read some here about MIME types for .htc extensions, but I don't know what to do for nginx or even if MIME type is the issue. If there is some other way to get the rounded corners without using an .htc file, I'm open to try that solution as well. Thanks.

回答1:

I've found the answer, this solution. It's the 2nd post down on the thread.

Comment by mjijackson@gmail.com, Oct 15, 2009

The directives are almost identical if you're using nginx. Open /etc/nginx/mime.types and add the following three lines inside your types {}declaration (in recent versions of nginx they're already there):

text/x-component htc;
application/x-shockwave-flash swf;
image/svg+xml svg;


回答2:

Try something like this..

location = /border-radius.htc {
  default_type 'text/x-component';
  try_files $uri /border-radius.htc;
}

Note the actual file location is relative to your root path.