In Nginx the correct url?

For example domain: mydomen.ru

You need to, if will meet in the url: /static/

For example: mydomen.ru/какой-то_текст1/static/какой-то_текст2

Cut: то_текст1

and the url looked like this: mydomen.ru/static/какой-то_текст2

PS. If the original mydomen.ru/static/какой-то_текст2 then to change anything it is not necessary.
And.. location /static/ is already used, so you need to not conflict.
June 10th 19 at 16:11
1 answer
June 10th 19 at 16:13
Solution
Yes Yes, I just read this, but still did not solve the problem. ) - toni26 commented on June 10th 19 at 16:16
only this will give the treatment location to another within nginx if you need to the user to show the change of address, it is necessary to return 301 (2) with the correct address.
If for bots - you'll be fine
rewrite ^(.*)/static/(.*) static/$2 last; - marcus.Wel commented on June 10th 19 at 16:19
Where is insert?

server {
 listen 80;
 server_name munin.mydomen.ru;
 access_log /var/www/munin.mydomen.EN/logs/access.log;
 error_log /var/www/munin.mydomen.ru/logs/error.log;

 location / {
 root /var/www/munin.mydomen.ru/www;
 index index.html;

 fastcgi_split_path_info ^(/)(.*);
 fastcgi_param PATH_INFO $fastcgi_path_info;
 include fastcgi_params;
 location unix:/var/run/munin/fcgi-munin-html.sock;

}

 location ^~ /munin-cgi/munin-cgi-graph/ {
 access_log off;
 fastcgi_split_path_info ^(/munin-cgi/munin-cgi-graph)(.*);
 fastcgi_param PATH_INFO $fastcgi_path_info;
 location unix:/var/run/munin/fcgi-munin-graph.sock;
 include fastcgi_params;
}

 location /nginx_status {
 stub_status on;
 access_log off;
 allow 127.0.0.1;
 #deny all;
}

 location /static/ {
 alias /etc/munin/static/;
}
}


No, the site is purely for me, i.e., outside the closed authorization. - toni26 commented on June 10th 19 at 16:22
Immediately behind the logs:
access_log /var/www/munin.mydomen.EN/logs/access.log;
error_log /var/www/munin.mydomen.ru/logs/error.log;
rewrite ^(.*)/static/(.*) static/$2 last;


In the end get a 404 error. But the url does not change! Probably not the put command.
PS. Can I have the rewrite module disabled, although by default it should be enabled. - toni26 commented on June 10th 19 at 16:25
only correct way
rewrite ^(.+)/static/(.*) /static/$2 last;
Don't forget the first slash and don't need to rariteti if the url already starts with /static/. - annie_Pagac commented on June 10th 19 at 16:28
Alexey Ten, thanks, worked. - toni26 commented on June 10th 19 at 16:31

Find more questions by tags Nginx