Home > other >  Google browser Nginx load balancing is invalid
Google browser Nginx load balancing is invalid

Time:09-18

Write a simple nginx load balancing, found that Internet explorer, firefox, edge, the browser can be normal, but Google browser that is not
Process is as follows: I am the ubuntu system (virtual machine), IP is 192.168.10.100
Now there are two projects, one is the basic2 basic3, nginx corresponding configuration file is as follows:
Basic2 project configuration file is test2. Conf, configure the port 8078
Server {
Listen, 8078;
Listen [: :] : 8078;

Root/var/WWW/HTML/basic2/web;

# Add index. PHP to the list if you are using PHP
The index index. HTML index. HTM index. Nginx - debian. HTML index. PHP;


The location/{
Root/var/WWW/HTML/basic2/web;
# the First attempt to serve the request as the file, then
# as the directory, and then fall back to displaying a 404.
# try_files $$uri uri/=404;
if (! - e $request_filename) {
Rewrite ^//index (. *). The PHP last;
}
}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
The location ~ \. PHP ${
Root/var/WWW/HTML/basic2/web;
The include snippets/fastcgi - PHP. Conf;
#
# # With php7.0 - cgi u.s:
# fastcgi_pass 127.0.0.1:9000;
# # With php7.0 - FPM:
Fastcgi_pass Unix:/run/PHP/php7.1 - FPM. The sock.
}

The location ~/\. Ht {
Deny all;
}
}

Basic3 project configuration file is test3. Conf, configure the port 8079
Server {
Listen, 8079;
Listen [: :] : 8079;

Root/var/WWW/HTML/basic3/web;

# Add index. PHP to the list if you are using PHP
The index index. HTML index. HTM index. Nginx - debian. HTML index. PHP;

The location/{
Root/var/WWW/HTML/basic3/web;
# the First attempt to serve the request as the file, then
# as the directory, and then fall back to displaying a 404.
# try_files $$uri uri/=404;
if (! - e $request_filename) {
Rewrite ^//index (. *). The PHP last;
}
}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
The location ~ \. PHP ${
Root/var/WWW/HTML/basic3/web;
The include snippets/fastcgi - PHP. Conf;
#
# # With php7.0 - cgi u.s:
# fastcgi_pass 127.0.0.1:9000;
# # With php7.0 - FPM:
Fastcgi_pass Unix:/run/PHP/php7.1 - FPM. The sock.
}

# to deny access to...htaccess files, if the Apache 's document root
# concurs with nginx 's one
#
The location ~/\. Ht {
Deny all;
}
}

In the browser access respectively, the results as follows:

Can be accessed here, now I configure load balancing service, its configuration file is the test. The conf, content as follows
Server {
listen 80;
Listen [: :] : 80;

# Add index. PHP to the list if you are using PHP
The index index. HTML index. HTM index. Nginx - debian. HTML index. PHP;

Server_name www.yiibasic.cn;

The location/{
Proxy_pass http://webservers;
}
}

And nginx nginx. Conf configuration is as follows:
HTTP {

Sendfile off;
Tcp_nopush on;
Tcp_nodelay on;
Keepalive_timeout 65;
Types_hash_max_size 2048;
# server_tokens off;

# server_names_hash_bucket_size 64;
# server_name_in_redirect off;

Include/etc/nginx/mime types;
Default_type application/octet - stream;

# #
# SSL Settings
# #

Ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
Ssl_prefer_server_ciphers on;

# #
# Logging Settings
# #

Access_log/var/log/nginx/access. The log.
Error_log/var/log/nginx/error log.

# #
# Gzip Settings
# #

Gzip on;
Gzip_disable "msie6";

# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# 16 gzip_buffers 8 k;
# gzip_http_version 1.1;
# gzip_types text/plain text/CSS application/json application/javascript text/XML application/XML + RSS application/XML text/javascript.

# #
# Virtual Host Configs
# #
Upstream webservers {
Server 192.168.10.100:8078 weight=1;
Server 192.168.10.100:8079 weight=3;
}

Include/etc/nginx/conf. D/*. Conf.
}

Use heavy 1:3 model, and then in the native host file to join 192.168.10.100 www.yiibasic.cn
When I was in firefox, ie visit http://www.yiibasic.cn/can see three basic3 appear a basic2 phenomenon of cycle, show a success, but is always basic3 on Google, occasionally a basic3 basic2, cache is cleared, no effect, I don't know what reason be??

CodePudding user response:

Haven't met, sit back and wait for others

CodePudding user response:

Use Ctrl + F5 to refresh see

CodePudding user response:

Their pressure test, manual browser to brush a few times meaningless

CodePudding user response:

If is to cache, you in the page plus time () time stamp, output, or the size of the HTTP response content have change,
However, I think the reason of the cache is not large, but to understand well the weight this configuration
It must be accurately according to the weight of your configuration to later period of distributed according to the proportion?

CodePudding user response:

Wait for results waiting for waiting for the results

CodePudding user response:

Wait for results waiting for waiting for the results
nullnullnullnullnullnullnullnull
  • Related