Answer the question
In order to leave comments, you need to log in
Why does a 404 file not found error occur?
hello everyone, tell me if there is some kind of automatic blocking by nginx for files like doc or docx?
if he puts a txt or jpg file in a directory on the server, it is located there and is perfectly given to nginx, but doc or docx get a 404 error. Why can doc and docx file types be blocked?
config
server {
listen 80;
server_name test.test.ru;
rewrite ^ https://$server_name$request_uri? permanent;
}
server {
listen 443 ssl;
keepalive_timeout 70;
keepalive_requests 150;
server_name test.test.ru;
set $server_root /usr/portal/site;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_dhparam /etc/ssl/test.pem;
ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA';
ssl_prefer_server_ciphers on;
ssl_certificate /etc/ssl/certs/key.crt;
ssl_certificate_key /etc/ssl/private/privkey.key;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
access_log /var/log/nginx/access.log main;
index index.php;
error_page 500 502 503 504 /500.html;
error_page 404 = /404.php;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host:443;
client_max_body_size 1024M;
client_body_buffer_size 4M;
proxy_set_header HTTPS YES;
add_header X-Frame-Options SAMEORIGIN;
location / {
root $server_root;
expires modified 2d;
proxy_pass http://upstream;
}
location ~ (.*).docx
{
root /usr/portal/site/upload/pics/;
}
}
Answer the question
In order to leave comments, you need to log in
location ~ (.*).docx
{
root /usr/portal/site/upload/pics/;
}
Here is your problem. JPG files are searched on a remote server (proxy_pass directive), and docx files are searched in /usr/portal/site/upload/pics/. Remove\change the location, or put the dock files in the /usr/portal/site/upload/pics/ folder.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question