there are three servers, one is a Nginx reverse proxy server, and it is also a static server, and two are web servers. Now, if you use a proxy server to visit a website, it is found that it takes longer to access a website than to visit a web server directly. By using a browser to check the specific situation, it is found that it takes longer to obtain static resources (such as js files, image files, etc.). But if it is very fast to access a single file directly, can anyone help me to see if there is something wrong with the configuration file of Nginx that I configured, or is it for other reasons? Thank you for your guidance!
here is the configuration of the Nginx server about Nginx:
user www www;
worker_processes 1; -sharp cpu
error_log logs/error.log crit; -sharp
-sharperror_log logs/error.log notice;
-sharperror_log logs/error.log info;
pid logs/nginx.pid;
worker_rlimit_nofile 65535;
events {
use epoll;
worker_connections 65535; -sharp worker
}
http {
include mime.types; -sharp nginxconf
default_type application/octet-stream; -sharp
log_format main "$remote_addr - $remote_user [$time_local] "$request" "
"$status $body_bytes_sent "$http_referer" "
""$http_user_agent" "$http_x_forwarded_for""; -sharp
access_log /home/wwwlogs/access.log main; -sharp
sendfile on; -sharp sendfile ""
tcp_nopush on; -sharp sendfile on
-sharpkeepalive_timeout 0;
keepalive_timeout 65; -sharp keepalive
tcp_nodelay on;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 128k;
gzip on; -sharp gzip
gzip_static on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.0;
gzip_comp_level 4;
gzip_types text/plain application/x-javascript text/css application/xml;
gzip_vary on;
proxy_cache_path /usr/local/nginx/cache_dir levels=1:2 keys_zone=cache_one:20m max_size=1g;
upstream load_balance {
-sharpserver 127.0.0.1:80;
server 132.232.163.17:80;
server 132.232.159.127:80;
ip_hash;
}
server {
listen 80;
server_name 118.24.167.113;
index index.html index.htm index.php; -sharp
-sharpcharset koi8-r;
-sharproot /home/html/www; -sharp
-sharpaccess_log logs/host.access.log gzip buffer=32k main;
location / {
-sharp
proxy_pass http://load_balance;
proxy_redirect off;
proxy_buffering off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 50m;
client_body_buffer_size 256k;
proxy_connect_timeout 1;
proxy_send_timeout 1;
proxy_read_timeout 1;
proxy_buffer_size 256k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
proxy_temp_file_write_size 256k;
proxy_next_upstream error timeout invalid_header http_500 http_503 http_404;
proxy_max_temp_file_size 128m;
proxy_cache cache_one;
proxy_cache_valid 200 1h;
proxy_cache_valid 404 1m;
proxy_cache_valid any 5m;
if ($request_uri ~* \.(ico|css|js|gif|png|jpe?g)$) {
expires 24h;
break;
}
}
location ~ \.(gif|jpg|js|png|jpeg) {
root /home/html/www;
-sharpaccess_log off;
-sharpexpires 1d;
-sharpproxy_pass http://localhost:80;
autoindex on;
}
-sharperror_page 404 /404.html;
-sharp redirect server error pages to the static page /50x.html
-sharp
error_page 500 502 503 504 /50x.html; -sharp 50x/50x.html
location = /50x.html { -sharp /50x.htmllocation
root html;
}
-sharp proxy the PHP scripts to Apache listening on 127.0.0.1:80
-sharp
-sharplocation ~ \.php$ {
-sharp proxy_pass http://127.0.0.1;
-sharp}
-sharp deny access to .htaccess files, if Apache"s document root
-sharp concurs with nginx"s one
-sharp
location ~ /\.ht {
deny all; -sharp
}
}
}