Skip to content

Instantly share code, notes, and snippets.

@chirag04
Created November 21, 2013 09:53
Show Gist options
  • Save chirag04/7578881 to your computer and use it in GitHub Desktop.
Save chirag04/7578881 to your computer and use it in GitHub Desktop.
nginx
location ~/profile_picture(^.+\.(jpg|jpeg|gif|png)$) {
alias /home/chirag/Desktop/xyz/profile_pictures/$1;
expires -1;
}
location ~*(^.+\.(jpg|jpeg|gif|css|png|js|ico|eot|otf|svg|ttf|woff|hbs)$) {
alias /home/chirag/Desktop/xyz/static/$1;
expires -1;
}
@chirag04
Copy link
Author

Eg: request with folder

/js/main.js - static folder

/profile_picture/3472asdasfd3.png - profile_picture folder.

@srinivasiyer
Copy link

Try the following:

location ~ (/profile_picture/^.+.(jpg|jpeg|gif|png)$) {
alias /home/chirag/Desktop/xyz/$1;
expires -1;
}

location ~ (/profile_picture/^.+.(jpg|jpeg|gif|png)$) {
alias /home/chirag/Desktop/xyz/$1;
expires -1;
}

@srinivasiyer
Copy link

location ~ (profile_picture/^.+.(jpg|jpeg|gif|png)$) {
alias /home/chirag/Desktop/xyz/$1;
expires -1;
}

@srinivasiyer
Copy link

location ~ /(^/profile_picture/.+.(jpg|jpeg|gif|png)$) {
alias /home/chirag/Desktop/xyz/$1;
expires -1;
}

@srinivasiyer
Copy link

location ~ ^/(profile_picture/.+.(jpg|jpeg|gif|png)$) {
alias /home/chirag/Desktop/xyz/$1;
expires -1;
}

location ~ ^/profile_picture/(.+.(jpg|jpeg|gif|png)$) {
alias /home/chirag/Desktop/xyz/profile_picture/$1;
expires -1;
}

@srinivasiyer
Copy link

location ~ ^/profile_picture/(.+.(jpg|jpeg|gif|png)$) {
alias /Users/Srini/sites/pb/profile_picture/$1;
expires -1;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment