server {
index index.html index.htm index.php;
server_name test.loc;
location / {
try_files $uri $uri/ /index.php?$args;
}
#error_page 500 502 503 504 /50x.html;
location ~ \.php$ {
if ($cookie_VAR = "1") {
root /Users/evgenij/projects/www/1;
}
if ($cookie_VAR = "2") {
root /Users/evgenij/projects/www/2;
}
root /Users/evgenij/projects/www/3;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_script_name;
}
}
curl --cookie "VAR=1" http://test.loc
curl --cookie "VAR=2" http://test.loc
curl http://test.loc
location = /captcha.jpg {
//тут либо пхп обработчик либо реврайт
rewrite ^/captcha.jpg /controller/common.php last;
}
server {
listen 80;
server_name sub.site.ru;
return 301 $scheme://site2.ru$request_uri;
}
set $host_uri $host$request_uri;
if ($host_uri ~ bla-bla){
rewrite ^(/(ru|en))(/.*) /community$3 last;
}
server {
listen 80;
server_name host1.blabla.com;
location / {
rewrite ^(/(ru|en))(/.*) /community$3 last;
}
}
server {
listen 80;
server_name host2.blabla.com;
location / {
#другое правило итд
rewrite ^(/(ru|en))(/.*) /community$3 last;
}
}