Answer the question
In order to leave comments, you need to log in
What are the limitations for nginx+fastcgi redirect requests?
Available: a pair of servers (id=1-primary, on VDS; id=2-backup (home)). They are synchronized by rsync, mysql in master-master mode, those are a full-fledged cluster in two nodes with a delay of about 100 ms. I still can’t adjust nginx to work in this mode, now I just use a group of servers (upstream) for fastcgi, but this way satika is loaded only from server id=1 and the browser doesn’t like it (when contacting the backup server, di=2 ignores loading statics) . Both servers have the same databases, all links are identical... What could be the problem? Here is the "stump" of the config:
fastcgi_cache_path ****<br/>
<br/>
upstream group_srv {<br/>
server 127.0.0.1:1234;<br/>
server 8.8.8.8:4321 backup;<br/>
}<br/>
server {<br/>
listen 80;<br/>
server_name google.ru <a href="http://www.google.ru">www.google.ru</a> server.google.ru;<br/>
--//<br/>
//--<br/>
location ~* ^/statics/.+\.(js|css|png|jpg|gif|jpeg|ico)$ {<br/>
root /var/www/google;<br/>
rewrite ^/.*(/statics/.*\.(js|css|png|jpg|gif|jpeg|ico))$ last;<br/>
access_log off;<br/>
expires 7d;<br/>
}<br/>
<br/>
location @default {<br/>
fastcgi_pass group_srv;<br/>
fastcgi_param SCRIPT_FILENAME $document_root/index.php;<br/>
include /etc/nginx/fastcgi_params;<br/>
fastcgi_param SCRIPT_NAME /index.php;<br/>
fastcgi_index index.php;<br/>
if ($do_not_cache != "1") {<br/>
add_header Vary Cookie;<br/>
}<br/>
}<br/>
<br/>
location / {<br/>
gzip_static on;<br/>
try_files $uri $uri/ @default;<br/>
if (-f $request_filename) {<br/>
expires max;<br/>
break;<br/>
}<br/>
set $cache_file '';<br/>
set $cache_uri $request_uri;<br/>
if ($request_method = POST) {<br/>
set $cache_uri '';<br/>
}<br/>
if ($query_string) {<br/>
set $cache_uri '';<br/>
}<br/>
if ($http_cookie ~* "my_coockie|any_coockie_" ) {<br/>
set $cache_uri '';<br/>
}<br/>
if ($cache_uri ~ ^(.+)$) {<br/>
set $cache_file /var/www/google/plugins/cache$http_host/$1index.html;<br/>
}<br/>
if (-f $document_root$cache_file) {<br/>
rewrite ^(.*)$ $cache_file break;<br/>
}<br/>
if (!-e $request_filename) {<br/>
rewrite . /index.php last;<br/>
}<br/>
}<br/>
}<br/>
Answer the question
In order to leave comments, you need to log in
if both servers are external then it is better to proxy the results, so you will have more control.
> but so satika is loaded only from the server id=1 of
course you also have it written that you should always take it from the root /var/www/google folder;
>rewrite ^/.*(/statics/.*\.(js|css|png|jpg|gif|jpeg|ico))$ last;
strange rule, what did you want to achieve with it?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question