A
A
Alexander Sharomet2020-11-12 18:36:51
PHP
Alexander Sharomet, 2020-11-12 18:36:51

Why does nginx display hieroglyphs instead of icons in css?

In one of the projects, the customer uses php to convert scss to css.
On the local machine with Apache, everything works fine, but there are problems under nginx.
From this code:

li::before {
  content: "\f105";
}

nginx does this:
li::before {
  content: ""; //непонятный символ
}

nginx settings:
server {
        listen 80;
        server_name site.loc www.site.loc;
        root /home/user/www/site.loc/scss/creator;

        index index.html index.htm index.php;

        location / {
                try_files $uri $uri/ =404;
        }
        location ~ \.php$ {
                include snippets/fastcgi-php.conf;
                fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
        }
        location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
                 expires max;
                 log_not_found off;
         }
}

What could be the problem?
Thanks

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Denis Yuriev, 2020-11-12
@sharomet

because char \f105 is a hieroglyph ) does the
font with icons load normally?
PS: I believe that you are trying to use fontawesome and either the font is not loaded or css

O
Oleg, 2020-11-12
@402d

in nginx config you have this line
charset UTF-8;
IMHO your browser thinks that the css file comes in an encoding other than UTF

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question