N
N
NOONE2017-05-04 20:30:37
Nginx
NOONE, 2017-05-04 20:30:37

NGINX when adding expire error 404 why?

Colleagues good evening, I need help, I haven’t worked with NGINX for a long time, then it became necessary to configure static caching.
I have such a config, when I log in to test123.com everything works good

server {
listen 80;
listen [::]:80;
server_name test123.com www.test123.com;
return 301 https://test123.com$request_uri;
}

server {
listen 443 ssl;
server_name www.test123.com;
return 301 https://test123.com$request_uri;
}

server {
listen 443 ssl;
listen [::]:443 ssl;

root /var/www/test123.com;

index index.html;

server_name test123.com;

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;
gzip_comp_level 5; 

ssl on;
ssl_certificate /etc/nginx/ssl/test123.com.crt;
ssl_certificate_key /etc/nginx/ssl/test123.com.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 10m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:SEED:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!RSAPSK:!aDH:!aECDH:!EDH-DSS-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA:!SRP;
ssl_prefer_server_ciphers on;

location / {
proxy_pass http://122.22.222.111/;

proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

}

But it's worth adding
location ~* ^.+\.(js|css|png|gif|svg|svgz|woff|woff2|jpg|jpeg|gif|ico)$ {
expires 1m;
add_header Cache-Control "public";

Everything breaks down at once, more precisely, when you enter test123, the site opens, but all the statics are not loaded, what could be the problem? once I struggled with the same problem in the config, added it separately
proxy_pass test123;
, it helped, the statics were loaded, now it does not help. Where to dig? PS broke his whole head
where the request proxy_pass 122.22.222.111/ is proxied; I don't know, I don't have access to it.
I watched by pressing F12, I can see how the GET request goes to test123/src/img/nameimg.jpg CODE 404.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question