Answer the question
In order to leave comments, you need to log in
How to make a redirect from a subdomain with a condition?
Tell me what am I doing wrong?
server {
server_name static.site.ru
listen ip;
charset UTF-8;
gzip on;
gzip_disable "msie6";
access_log off;
log_not_found off;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript;
set $root_path /var/www/data/static.site.ru;
proxy_read_timeout 1200s;
location / {
proxy_pass http://ip:80;
proxy_redirect http://ip:80/ /;
proxy_set_header Host $host;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
if ($request_uri !~ "^/uploads/\w+$") {
rewrite ^(.*)$ http://www.site.ru$1 permanent;
}
}
location /uploads/card/ {
alias /var/www/data/static.site.ru/uploads/card/;
set $disable_cache 1;
set $button_redirect 0;
#.....
}
}
Answer the question
In order to leave comments, you need to log in
Something like this :)
location /{
rewrite ^ http://site.ru permanent;
}
location ~ ^/(uploads)/{
root /var/www/data/static.site.ru;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question