Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Nginx Rewrite Rules - Image Issue

Options
  • 02-04-2017 10:13pm
    #1
    Registered Users Posts: 1,987 ✭✭✭


    I have the below rules converted from htaccess but they don't seem to be working for me. I'm a bit stumped, my other rules I've converted to Nginx work fine, it's just images that aren't working.

    I keep getting the below errors:
    2017/04/02 23:15:16 [error] 27629#0: *6 open() "/var/www/html/media/images/blog/10_1.png" failed (2: No such file or directory), client: xxx.xxx.xxx.xxx, server: www.website.com, request: "GET /media/images/blog/10_1.png HTTP/1.1", host: "www.website.com", referrer: "https://www.website.com/blog/"

    Any help greatly appreciated.

    Apache:
    RewriteRule ^media/images/([^/]+)/([^/]+)_([^-]+)_([^-]+)\.png$ /img.php?prefix=$1&refId=$2&thumb=$3&iid=$4 [L]
    RewriteRule ^media/images/([^/]+)/([^/]+)_([^-]+)\.png$ /img.php?prefix=$1&refId=$2&thumb=$3 [L]
    

    Nginx:
    location /media/images { 
    	rewrite ^/media/images/([^/]+)/([^/]+)_([^-]+)_([^-]+)\.png$ /img.php?prefix=$1&refId=$2&thumb=$3&iid=$4 last; 
    	rewrite ^/media/images/([^/]+)/([^/]+)_([^-]+)\.png$ /img.php?prefix=$1&refId=$2&thumb=$3 last; 
    }
    


Advertisement