We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
实验性尝试了一下nginx的负载均衡,可以的。挺有意思的,但单进程性能已经够了。
worker_processes auto; events { worker_connections 1024; } http { # 本地起两个express server upstream mybalance01 { # weight越高收到的请求越多 server 127.0.0.1:3000 weight=1 max_fails=5 fail_timeout=3; server 127.0.0.1:34213 weight=2 max_fails=5 fail_timeout=3; } # 缓存目录 # NOTE:可以用nginx的缓存替换掉代码内部GET缓存 # proxy_cache_path tmp/nxcache levels=1:2 keys_zone=my_cache:10m inactive=30s; # 定义 MIME 类型和默认字符集 # include /etc/nginx/mime.types; # default_type application/octet-stream; # include mime.types; # default_type application/octet-stream; # sendfile on; # keepalive_timeout 65; # 反向代理配置 server { listen 80; # 下载功能进行负载均衡 location /api/download/ { proxy_pass http://mybalance01; } # 其他请求都主服务器 # NOTE:哪天数据库不用sqlite,换成mysql之类的,连这个也可以换成负载均衡 location / { proxy_pass http://localhost:3000; } } }
The text was updated successfully, but these errors were encountered:
参考
https://www.cnblogs.com/taiyonghai/p/9402734.html https://nginx.org/en/docs/beginners_guide.html#control
Sorry, something went wrong.
No branches or pull requests
实验性尝试了一下nginx的负载均衡,可以的。挺有意思的,但单进程性能已经够了。
The text was updated successfully, but these errors were encountered: