Answer the question
In order to leave comments, you need to log in
How to rewrite a folder with a domain name in nginx?
There is a site on laravel which works on several domains.
The /srv/web/split/storage/markets folder contains sat resources. Since php will distribute these files much slower than an alias (rewrite) in nginx, you need to make this alias that gives files from /srv/web/split/storage/markets/$HOST/$FILE
at $HOST/resources/$FILE
. If this file does not exist, we give it from root (/srv/web/split/public)
Help organize this rewrite.
Site config at the moment:
server {
listen 80;
server_name domain1.ru domain2.ru domain3.ru domain4.ru;
root /srv/web/split/public;
index index.html index.php;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
}
aaa.hostname.ru/resources/app.min.css -> /srv/web/split/storage/markets/hostname.ru/app.min.css
Answer the question
In order to leave comments, you need to log in
location /resources/ {
alias /srv/web/split/storage/markets/$host/;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question