На псевдониме сайта не кешируются картинки и другие файлы - nginx

ellaizzer nginx-forum на forum.nginx.org
Пн Янв 15 08:43:18 UTC 2018


Есть сайт (заменил на example.com)

Вот его nginx конфиг:


server {
    server_name example.com m.example.com www.example.com
www.m.example.com;
    charset off;
    disable_symlinks if_not_owner from=$root_path;
    index index.html index.php;
    root $root_path/$subdomain;
    set $root_path /var/www/examplecom/data/www;
    set $subdomain example.com;
    ssi on;
    access_log /var/www/httpd-logs/example.com.access.log ;
    error_log /var/www/httpd-logs/example.com.error.log notice;
    include /etc/nginx/vhosts-includes/*.conf;
    include /etc/nginx/vhosts-resources/example.com/*.conf;
    location / {
        location ~*
^.+\.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar|swf|woff|ttf|otf||woff2|eot)$
{
            try_files $uri $uri/ @fallback;
            expires 6M;
        }
        location / {
            try_files /does_not_exists @fallback;
        }
        location ~ [^/]\.ph(p\d*|tml)$ {
            try_files /does_not_exists @fallback;
        }
    }
    location @fallback {
        error_log /dev/null crit;
        proxy_pass http://127.0.0.1:8080;
        proxy_redirect http://127.0.0.1:8080 /;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-Port $server_port;
        access_log off ;
    }
            if ($host ~* ^((.*).example.com)$) {
                set $subdomain $1;
            }
    gzip on;
    gzip_comp_level 5;
    gzip_disable "msie6";
    gzip_types text/plain text/css image/jpeg image/png image/gif text/xml
application/xml application/xhtml+xml text/javascript
application/x-javascript application/javascript;
    listen 8.1.35.82:80;
}


Проблема в том что не кешуруются файлы на псевдонимах m.example.com и
www.m.example.com, но кешируются на example.com и www.example.com 

Кто подскажет в чем может быть проблема некеширования на псевдонимах?

Posted at Nginx Forum: https://forum.nginx.org/read.php?21,278140,278140#msg-278140



Подробная информация о списке рассылки nginx-ru