Reputation: 357
I have the following folders:
/web/domain1/
/web/domain2/
/web/shared/
I want domain1 and domain2 to share static files from /web/shared/
but I am having trouble creating the mapping in nginx.
domain1: /assets/ mapped to /web/shared/
domain2: /admin/assets/ mapped to /web/shared/
server{
server_name domain1;
root /web/domain1/;
location / {
rewrite /assets/(.*) /web/shared/$1;
}
}
This gives me 404 error.
Upvotes: 1
Views: 92
Reputation: 49672
Define a location
for URIs that begin with /assets/
(see this document for details). Use the alias
directive, as the root
directive cannot be used in this case (see this document for details).
For example:
location /assets/ {
alias /web/shared/;
}
Upvotes: 1