nginx正向代理如何优化?
把服务器A作为代理服务器,内网所有用户通过代理A访问外网(http协议,其他暂不考虑),现在已经能实现其基本功能,但是代理效果不好,开网页有点卡,请问如何提升nginx正向代理速度?
nginx.cnf如下
worker_processes 8; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; server { listen 8080; server_name X.X.X.X; #DNS 也用过国内的DNS,但开网页速度没有提升 resolver 8.8.8.8; #charset koi8-r; #access_log logs/host.access.log main; location / { proxy_pass $scheme://$http_host$request_uri; proxy_set_header Host $http_host; proxy_buffers 256 4K; proxy_max_temp_file_size 0; proxy_connect_timeout 30; proxy_cache_valid 200 302 10m; proxy_cache_valid 301 1h; proxy_cache_valid any 1m; # proxy_set_header X-Real-IP $remote_addr; # proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } }
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
用Nginx的主要原因是BOSS想在Nginx上做二次开发
squid不支持么?
第一次看到用 Nginx 做正向代理的,这也不是它的专长啊
用 Squid 呗。