Question

media files with russian characters - returns 404 not found

  • Posted on February 1, 2022
  • ut4utcAsked by ut4utc

Hi there,

I have a troble with nginx, when I want see this file - nginx show me 404 not found.

https://bytecode.com.ua/wp-content/uploads/Дибилы-завязывающие-с-выпивкой.mp4

My nginx config /etc/nginx/nginx.conf:

user www-data;
worker_processes 1;
error_log  /var/log/nginx/error.log warn;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
        worker_connections 768;
        # multi_accept on;
}
http {
        charset UTF-8;
        ##
        # Basic Settings
        ##
        sendfile on;
        tcp_nopush on;
        tcp_nodelay on;
        keepalive_timeout 65;
        types_hash_max_size 512;
        types_hash_bucket_size 128;
        client_max_body_size   160M;

        server_names_hash_bucket_size 64;
        # server_name_in_redirect off;

        include /etc/nginx/mime.types;
        default_type application/octet-stream;

        ##
        # SSL Settings
        ##

        ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
        ssl_prefer_server_ciphers on;

        ##
        # Logging Settings
        ##

        access_log /var/log/nginx/access.log;
        error_log /var/log/nginx/error.log;

        ##
        # Gzip Settings
        ##

        gzip on;

        #gzip_vary on;
        #gzip_proxied any;
        #gzip_comp_level 6;
        #gzip_buffers 16 8k;
        #gzip_http_version 1.1;
        #gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;

        ##
        # Virtual Host Configs
        ##

        include /etc/nginx/conf.d/*.conf;
        include /etc/nginx/sites-enabled/*;
        # add http2
        add_header Strict-Transport-Security "max-age=15768000; includeSubDomains" always;
}

My website config /etc/nginx/sites-available/bytecode.com.ua

server {
        root /var/www/bytecode.com.ua/public_html;
        index index.html index.htm index.php;

        server_name bytecode.com.ua www.bytecode.com.ua;

        charset utf-8;

        # HSTS
    add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;

        # включаем сжатие gzip
        gzip on;
        gzip_disable "msie6";
        gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript;

        # Static Content
    location ~* ^.+\.(jpg|jpeg|gif|png|ico|tiff|css|js)$ {
        expires 6M; # Кеширум на 6 месяцев
        add_header Cache-Control public;
        add_header Pragma public;
        rewrite "^(.*);jsessionid=(.*)$" $1 permanent;
    }
        # ETAG
        location ~* ^.+\.(rss|atom|jpg|jpeg|gif|png|ico|rtf|js|css)$ {
        expires 2592000;
        }

        location ~ \.php$ {
           include snippets/fastcgi-php.conf;
           fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
        }

        location / {
           try_files $uri $uri/ /index.php?q=$uri&$args;
        }

        location ~ /\.ht {
           deny all;
        }

        listen [::]:443 ssl http2; #ipv6only=on; # managed by Certbot
        listen 443 ssl; # managed by Certbot
        ssl_certificate /etc/letsencrypt/live/bytecode.com.ua/fullchain.pem; # managed by Certbot
        ssl_certificate_key /etc/letsencrypt/live/bytecode.com.ua/privkey.pem; # managed by Certbot
        include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
        ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
    if ($host = www.bytecode.com.ua) {
        return 301 https://$host$request_uri;
    } # managed by Certbot

    listen 80;
    listen [::]:80;

        server_name bytecode.com.ua www.bytecode.com.ua;
    return 404; # managed by Certbot
}

File really staying at this path and really located on hdd: https://bytecode.com.ua/wp-content/uploads/Дибилы-завязывающие-с-выпивкой.mp4

Pleace help me with configuration UTF8 nginx.


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer