1👍
If you use url like: http://your.page.com/static/image.gif
then with your rules you get such uri (including alias
directive):
/home/ubuntu/workspace/mysiteimage.gif;
So conclusion is that remove last /
from location
directive (it should be /static
) or add at the end to alias
directive /
(so it will be as alias /home/ubuntu/workspace/mysite/;
)
Other solution could be like:
location ~ (static/.*) {
alias /home/ubuntu/workspace/mysite/$1;
# ... rest of code here
}
Then you don’t have to add static
again in alias
directive. You just use it as location param ($1 = static/.*).
Why that way? alias
directive (alias doc) work as follow: it trims from requested url part matched in location
directive end then, with what will stay, append to it own rule path. In your example from url /static/image.gif/
it will trim /static/
and to your alias
path append only image.gif
so it will look like I wrote: /home/ubuntu/workspace/mysiteimage.gif/`.