简体   繁体   中英

NGINX, Include in my virtual host file

I have a DV server with MediaTemple and recently had their support enable ngnix webserver. I have been integrating their ProCDN with Super Cache on the WordPress sites on the DV.

I noticed on this domain convoyofhope.eu that the CDN is working properly, but if you view the site on Firefox the fontface isn´t working because of the cross-domain issue. I found this site that seems to solve the problem http://www.red-team-design.com/firefox-doesnt-allow-cross-domain-fonts-by-default

My question is, in the site it says:

Also, if you are using nginx as your webserver you will need to include the code below in your virtual host file:

location ~* \.(eot|otf|ttf|woff)$ {
    add_header Access-Control-Allow-Origin *;
}

I am just not sure where I put this on my server. I checked the vhost for convoyofhope.eu but I didn´t see where I would add that to make this work. Thanks for any feedback.

It would generally go in the nginx configuration file that has the server block for that host:

server {
    listen       80;
    server_name  convoyofhope.eu;

    ...
    location ~* \.(eot|otf|ttf|woff)$ {
        add_header Access-Control-Allow-Origin *;
    }
    ...
}

On RHEL related distributions, this would be on the file system somewhere under /etc/nginx/ . Your particular distribution may vary.

On MediaTemple, in your Plesk control panel, go to Websites & Domains (tab) -> Web Server Settings then scroll down to "Additional nginx directives". Place your location… directive in the text box there.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM