server {
listen 80;
server_name sub.site.local;
index index.php;
client_max_body_size 100M;
fastcgi_read_timeout 1800;
location /hotels {
root /projects/newsite/public;
try_files $uri $uri/ /index.php?$query_string;
add_header X-location newsite;
include fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass cabinet:9000;
}
location / {
root /projects/oldsite;
try_files $uri $uri/ /index.php?$query_string;
add_header X-location oldsite;
include fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass agent:9000;
}
}
server {
listen 80;
server_name sub.site.local
root /projects/oldsite;
index index.php;
client_max_body_size 100M;
fastcgi_read_timeout 1800;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
# if (!-d $request_filename) {
# rewrite ^/(.+)/$ /$1 permanent;
# }
location ~* ^/new/(.+\.(?:gif|jpe?g|png|ico|js|css))$ {
alias /projects/newsite/public/$1;
expires max;
log_not_found off;
access_log off;
}
location /new/ {
alias /projects/newsite/public;
try_files $uri $uri/ @new;
location ~* \.php {
include fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /projects/newsite/public/index.php;
fastcgi_pass newsite:9000;
}
}
location @new {
rewrite ^/new/(.*)$ /new/index.php?$1 last; # THIS IS THE IMPORTANT LINE
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
access_log off;
}
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass oldsite:9000;
}
}