Get the most out of your Centmin Mod LEMP stack
Become a Member

Jamroom

Discussion in 'Blogs & CMS usage' started by Jimmy, Nov 28, 2015.

  1. Jimmy

    Jimmy Well-Known Member

    1,704
    365
    83
    Oct 24, 2015
    East Coast USA
    Ratings:
    +923
    Local Time:
    2:59 AM
    1.17.x
    MariaDB 10.3.x
    I believe I solved the issue. I created specific blocks for the each directory which will not include the dynamic directory which the specific images are located. /image/img/module/jrCore/ (not an actual directory on the server).

    @eva2000 if you get a chance, could you just check to make sure my location block syntax is correct. I believe it is. When I did a location block with the above directory (/image/img/module/jrCore/) it blocked the images. I just want to make sure that I have my syntax correct. Hopefully this will resolve all the issues.

    Code:
    location ~^(/modules/).*(\.(3gp|gif|jpg|jpeg|png|ico|wmv|avi|asf|asx|mpg|mpeg|mp4|pls|mp3|mid|wav|swf|flv|exe|zip|tar|rar|gz|tgz|bz2|uha|7z|doc|docx|xls|xlsx|pdf|iso))$ {
        gzip_static off;
        #add_header Pragma public;
        add_header Cache-Control "public, must-revalidate, proxy-revalidate";
        access_log off;
        expires 30d;
        break;
    }
    location ~^(/data/).*(\.(3gp|gif|jpg|jpeg|png|ico|wmv|avi|asf|asx|mpg|mpeg|mp4|pls|mp3|mid|wav|swf|flv|exe|zip|tar|rar|gz|tgz|bz2|uha|7z|doc|docx|xls|xlsx|pdf|iso))$ {
        gzip_static off;
        #add_header Pragma public;
        add_header Cache-Control "public, must-revalidate, proxy-revalidate";
        access_log off;
        expires 30d;
        break;
    }
    location ~^(/skins/).*(\.(3gp|gif|jpg|jpeg|png|ico|wmv|avi|asf|asx|mpg|mpeg|mp4|pls|mp3|mid|wav|swf|flv|exe|zip|tar|rar|gz|tgz|bz2|uha|7z|doc|docx|xls|xlsx|pdf|iso))$ {
        gzip_static off;
        #add_header Pragma public;
        add_header Cache-Control "public, must-revalidate, proxy-revalidate";
        access_log off;
        expires 30d;
        break;
    }

     
    Last edited: Feb 16, 2016
  2. eva2000

    eva2000 Administrator Staff Member

    44,717
    10,193
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,797
    Local Time:
    4:59 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    not sure i understand they're
    Code:
    /image/img/module/jrCore/
    /image/img/data/jrCore/
    /image/img/skins/jrCore/
    ?
     
  3. Jimmy

    Jimmy Well-Known Member

    1,704
    365
    83
    Oct 24, 2015
    East Coast USA
    Ratings:
    +923
    Local Time:
    2:59 AM
    1.17.x
    MariaDB 10.3.x
    I'm not 100% sure either. It's how the system displays those images in a dynamic way I suppose. Just those specific images... it's like a total of 7 images in the whole system which are all in the backend or Admin Control Panel (ACP).

    That's the location of the specific images /image/img/module/jrCore/someimage.jpg

    Those other directories listed above are actual directories which I want the staticfiles.conf to apply too.
     
  4. Jimmy

    Jimmy Well-Known Member

    1,704
    365
    83
    Oct 24, 2015
    East Coast USA
    Ratings:
    +923
    Local Time:
    2:59 AM
    1.17.x
    MariaDB 10.3.x
    The /image/img/ isn't a directory at all.

    The only directories for Jamroom are:

    /data/
    /modules/
    /skins/

    That's it.*

    * there are sub-directories in the above directories.
     
  5. eva2000

    eva2000 Administrator Staff Member

    44,717
    10,193
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,797
    Local Time:
    4:59 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    just place this above generic image extension location match context

    Code:
    location ~ /(data|modules|skins)/ {
        include /usr/local/nginx/conf/php.conf;
        location ~* \.(gif|jpg|jpeg|png|ico)$ {
            add_header Cache-Control "public, must-revalidate, proxy-revalidate";
            access_log off;
            expires 30d;
        }
    }
    
     
    Last edited: Feb 16, 2016
  6. Jimmy

    Jimmy Well-Known Member

    1,704
    365
    83
    Oct 24, 2015
    East Coast USA
    Ratings:
    +923
    Local Time:
    2:59 AM
    1.17.x
    MariaDB 10.3.x
    Didn't like that. When I used that for every page it pops up a "save file" option.
     
  7. eva2000

    eva2000 Administrator Staff Member

    44,717
    10,193
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,797
    Local Time:
    4:59 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    Add to it
    Code:
    include /usr/local/nginx/conf/php.conf;
    Code:
    location ~ /(data|modules|skins)/ {
        include /usr/local/nginx/conf/php.conf;
        location ~* \.(gif|jpg|jpeg|png|ico)$ {
            add_header Cache-Control "public, must-revalidate, proxy-revalidate";
            access_log off;
            expires 30d;
        }
    }
    
     
  8. Jimmy

    Jimmy Well-Known Member

    1,704
    365
    83
    Oct 24, 2015
    East Coast USA
    Ratings:
    +923
    Local Time:
    2:59 AM
    1.17.x
    MariaDB 10.3.x
    Just to make sure. Did you want me to add your code above what is below or remove what is below (code in this post) all together? When I removed what is below and replaced it with what you have above, it works. Though, there really isn't any way to test if the new code is working. Because, when the org code below is removed, everything works.

    Code:
    location ~* \.(3gp|gif|jpg|jpeg|png|ico|wmv|avi|asf|asx|mpg|mpeg|mp4|pls|mp3|mid|wav|swf|flv|exe|zip|tar|rar|gz|tgz|bz2|uha|7z|doc|docx|xls|xlsx|pdf|iso)$ {
        gzip_static off;
        #add_header Pragma public;
        add_header Cache-Control "public, must-revalidate, proxy-revalidate";
        access_log off;
        expires 30d;
        break;
    }
     
  9. eva2000

    eva2000 Administrator Staff Member

    44,717
    10,193
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,797
    Local Time:
    4:59 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    place above existing image location context match

    Code:
    location ~ /(data|modules|skins)/ {
        include /usr/local/nginx/conf/php.conf;
        location ~* \.(gif|jpg|jpeg|png|ico)$ {
            add_header Cache-Control "public, must-revalidate, proxy-revalidate";
            access_log off;
            expires 30d;
        }
    }
    
    location ~* \.(3gp|gif|jpg|jpeg|png|ico|wmv|avi|asf|asx|mpg|mpeg|mp4|pls|mp3|mid|wav|swf|flv|exe|zip|tar|rar|gz|tgz|bz2|uha|7z|doc|docx|xls|xlsx|pdf|iso)$ {
        gzip_static off;
        #add_header Pragma public;
        add_header Cache-Control "public, must-revalidate, proxy-revalidate";
        access_log off;
        expires 30d;
        break;
    }
    
     
  10. Jimmy

    Jimmy Well-Known Member

    1,704
    365
    83
    Oct 24, 2015
    East Coast USA
    Ratings:
    +923
    Local Time:
    2:59 AM
    1.17.x
    MariaDB 10.3.x
    I tried it like you have it above and it didn't work. The images aren't showing. The only way I've found it to work is with the three separate locations.
     
  11. eva2000

    eva2000 Administrator Staff Member

    44,717
    10,193
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,797
    Local Time:
    4:59 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    did you restart both nginx and php-fpm ?
     
  12. eva2000

    eva2000 Administrator Staff Member

    44,717
    10,193
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,797
    Local Time:
    4:59 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    or try adding a break into the new image extension location context match
    Code:
    location ~ /(data|modules|skins)/ {
        include /usr/local/nginx/conf/php.conf;
        location ~* \.(gif|jpg|jpeg|png|ico)$ {
            add_header Cache-Control "public, must-revalidate, proxy-revalidate";
            access_log off;
            expires 30d;
            break;
        }
    }
    
    location ~* \.(3gp|gif|jpg|jpeg|png|ico|wmv|avi|asf|asx|mpg|mpeg|mp4|pls|mp3|mid|wav|swf|flv|exe|zip|tar|rar|gz|tgz|bz2|uha|7z|doc|docx|xls|xlsx|pdf|iso)$ {
        gzip_static off;
        #add_header Pragma public;
        add_header Cache-Control "public, must-revalidate, proxy-revalidate";
        access_log off;
        expires 30d;
        break;
    }
    
     
  13. Jimmy

    Jimmy Well-Known Member

    1,704
    365
    83
    Oct 24, 2015
    East Coast USA
    Ratings:
    +923
    Local Time:
    2:59 AM
    1.17.x
    MariaDB 10.3.x
    Still broken. Tried the break code. Tried after restarting php and nginx.
     
  14. eva2000

    eva2000 Administrator Staff Member

    44,717
    10,193
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,797
    Local Time:
    4:59 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    check your error log for nginx vhost domain i.e. /home/nginx/domains/domain.com/log/error.log

    or just do it as you did with 3 separate location matches
     
  15. eva2000

    eva2000 Administrator Staff Member

    44,717
    10,193
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,797
    Local Time:
    4:59 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    but if that is location of image then it should be without s in modules
    Code:
    location ~ /image/img/(data|module|skins)/ {
        include /usr/local/nginx/conf/php.conf;
        location ~* \.(gif|jpg|jpeg|png|ico)$ {
            add_header Cache-Control "public, must-revalidate, proxy-revalidate";
            access_log off;
            expires 30d;
            break;
        }
    }
     
  16. Jimmy

    Jimmy Well-Known Member

    1,704
    365
    83
    Oct 24, 2015
    East Coast USA
    Ratings:
    +923
    Local Time:
    2:59 AM
    1.17.x
    MariaDB 10.3.x
    The error log is pretty much saying that it can't find the files.

    Code:
    2016/02/16 00:26:46 [error] 5649#5649: *12 open() "/home/nginx/domains/10.0.0.122/public/image/img/module/jrCore/option_pass.png" failed (2: No such file or directory), client: 10.0.0.245, server: 10.0.0.122, request: "GET /image/img/module/jrCore/option_pass.png?_v=1455582406 HTTP/2.0", host: "10.0.0.122", referrer: "https://10.0.0.122/core/system_check"
    2016/02/16 00:26:46 [error] 5649#5649: *12 open() "/home/nginx/domains/10.0.0.122/public/image/img/module/jrCore/option_fail.png" failed (2: No such file or directory), client: 10.0.0.245, server: 10.0.0.122, request: "GET /image/img/module/jrCore/option_fail.png?_v=1455582406 HTTP/2.0", host: "10.0.0.122", referrer: "https://10.0.0.122/core/system_check"
    2016/02/16 00:26:46 [error] 5649#5649: *12 open() "/home/nginx/domains/10.0.0.122/public/image/img/module/jrCore/option_pass.png" failed (2: No such file or directory), client: 10.0.0.245, server: 10.0.0.122, request: "GET /image/img/module/jrCore/option_pass.png?_v=1455582406 HTTP/2.0", host: "10.0.0.122", referrer: "https://10.0.0.122/core/system_check"
    2016/02/16 00:26:46 [error] 5649#5649: *12 open() "/home/nginx/domains/10.0.0.122/public/image/img/module/jrCore/option_fail.png" failed (2: No such file or directory), client: 10.0.0.245, server: 10.0.0.122, request: "GET /image/img/module/jrCore/option_fail.png?_v=1455582406 HTTP/2.0", host: "10.0.0.122", referrer: "https://10.0.0.122/core/system_check"
    2016/02/16 00:26:46 [error] 5649#5649: *12 open() "/home/nginx/domains/10.0.0.122/public/image/img/skin/jrElastic/bckgrd.png" failed (2: No such file or directory), client: 10.0.0.245, server: 10.0.0.122, request: "GET /image/img/skin/jrElastic/bckgrd.png HTTP/2.0", host: "10.0.0.122", referrer: "https://10.0.0.122/data/cache/jrElastic/S89db1641a421044025ea4ba8ab49a83f.css"
    2016/02/16 00:26:46 [error] 5649#5649: *12 open() "/home/nginx/domains/10.0.0.122/public/image/img/module/jrCore/lightbox2-close.png" failed (2: No such file or directory), client: 10.0.0.245, server: 10.0.0.122, request: "GET /image/img/module/jrCore/lightbox2-close.png HTTP/2.0", host: "10.0.0.122", referrer: "https://10.0.0.122/data/cache/jrElastic/S89db1641a421044025ea4ba8ab49a83f.css"
    2016/02/16 00:26:46 [error] 5649#5649: *12 open() "/home/nginx/domains/10.0.0.122/public/image/img/module/jrCore/lightbox2-loading.gif" failed (2: No such file or directory), client: 10.0.0.245, server: 10.0.0.122, request: "GET /image/img/module/jrCore/lightbox2-loading.gif HTTP/2.0", host: "10.0.0.122", referrer: "https://10.0.0.122/data/cache/jrElastic/S89db1641a421044025ea4ba8ab49a83f.css"
    2016/02/16 00:26:46 [error] 5649#5649: *12 open() "/home/nginx/domains/10.0.0.122/public/image/img/module/jrCore/lightbox2-prev.png" failed (2: No such file or directory), client: 10.0.0.245, server: 10.0.0.122, request: "GET /image/img/module/jrCore/lightbox2-prev.png HTTP/2.0", host: "10.0.0.122", referrer: "https://10.0.0.122/data/cache/jrElastic/S89db1641a421044025ea4ba8ab49a83f.css"
    2016/02/16 00:26:46 [error] 5649#5649: *12 open() "/home/nginx/domains/10.0.0.122/public/image/img/module/jrCore/lightbox2-next.png" failed (2: No such file or directory), client: 10.0.0.245, server: 10.0.0.122, request: "GET /image/img/module/jrCore/lightbox2-next.png HTTP/2.0", host: "10.0.0.122", referrer: "https://10.0.0.122/data/cache/jrElastic/S89db1641a421044025ea4ba8ab49a83f.css"
    
    Tried your code above and it didn't work.

    This location below doesn't really exist. Not sure exactly how the code is handling and creating this, but it's a really pain in my butt. The images are from jrCore which is a module. The entire system is modules. Even the core of the program is a module. It's a unique design - nothing I've ever seen. But the developer really does know what he is doing. Jamroom has been around for over 10 years.
    Code:
    /image/img/module/jrCore/someimage.jpg
    Thanks for all your help! :) If you think of something else to try, let me know. The three locations seems to work and I'll have to go with that.
     
  17. eva2000

    eva2000 Administrator Staff Member

    44,717
    10,193
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,797
    Local Time:
    4:59 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    ah it has upper case C so try
    Code:
    location ~* /image/img/(data|module|skins)/ {
        include /usr/local/nginx/conf/php.conf;
        location ~* \.(gif|jpg|jpeg|png|ico)$ {
            add_header Cache-Control "public, must-revalidate, proxy-revalidate";
            access_log off;
            expires 30d;
            break;
        }
    }
    or
    Code:
    location ~* /image/img/module/jrCore/ {
        include /usr/local/nginx/conf/php.conf;
        location ~* \.(gif|jpg|jpeg|png|ico)$ {
            add_header Cache-Control "public, must-revalidate, proxy-revalidate";
            access_log off;
            expires 30d;
            break;
        }
    }
    
    location ~* /image/img/(data|skins)/ {
        include /usr/local/nginx/conf/php.conf;
        location ~* \.(gif|jpg|jpeg|png|ico)$ {
            add_header Cache-Control "public, must-revalidate, proxy-revalidate";
            access_log off;
            expires 30d;
            break;
        }
    }
    
     
  18. Jimmy

    Jimmy Well-Known Member

    1,704
    365
    83
    Oct 24, 2015
    East Coast USA
    Ratings:
    +923
    Local Time:
    2:59 AM
    1.17.x
    MariaDB 10.3.x
    No luck. Neither worked.
     
  19. eva2000

    eva2000 Administrator Staff Member

    44,717
    10,193
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,797
    Local Time:
    4:59 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    what about might be missing
    Code:
    try_files  $uri $uri/  $uri/modules/jrCore/router.php?_uri=$args;
    Code:
    location ~* /image/img/ {
        try_files  $uri $uri/  $uri/modules/jrCore/router.php?_uri=$args;
        include /usr/local/nginx/conf/php.conf;
        location ~* \.(gif|jpg|jpeg|png|ico)$ {
            add_header Cache-Control "public, must-revalidate, proxy-revalidate";
            access_log off;
            expires 30d;
            break;
        }
    }
     
  20. Jimmy

    Jimmy Well-Known Member

    1,704
    365
    83
    Oct 24, 2015
    East Coast USA
    Ratings:
    +923
    Local Time:
    2:59 AM
    1.17.x
    MariaDB 10.3.x
    Nope, that didn't work.