|
这几天看了lnamp的安装,又鼓捣了一下反向代理的缓存,于是后端独服(其实就跑一个博客)的负载下降到0.5以下,否则平时如果运行一个负载监控脚本,独服每晚都要死机n次,于是就萌生想法要把博客转移到虚拟主机(我认为虚拟空间比限制了cpu和内存的vps突发性能要好)每月还能省出七八百
。
看上了hg,几番麻烦验证总算给我通过了包年空间,改下nginx后端ip,重启nginx,于是503 bad gateway不断,停掉nginx用curl测试,连接正常!看来hg的虚拟空间有单ip连接数限制啊!
无奈tk之,希望能把前端的ip加到白名单不做连接数限制,hg回复要我自己解决。。。
目前转移到84的vps再次优化了一下nginx缓存设置,运行良好....
附语法蹩脚的tk原文如下
my hosting is on gator1049.hostgator.com,username xxxxxxxxxxxxxxx.
actually,
I use this shared hosting as a backend , my domain is pointed to another server which is a vps runing a nginx as a frontend .
So there will be a lot of connetions between my frontend server and my shared hosting,
but seems you have a max-conn-limit from the same IP on shared hosting from to prevent your server running on a high load.
When I was testing them I always get a 502 error code,that means connections between nginx and my hosting can't be made.I shutdown nginx,try curl gator1049.hostgator.com to retrieve your default page,then it works OK.
So I think that it might be you max-conn-limit set couse my frontend nginx work hardly.
could you please add my frontend's IP 178.162.x.x to the whitelist,or do some changes,to unlimit the connection from that single IP.
btw,I have this config code on nginx to encure it has cache locally,
proxy_cache_path /home/proxy_cache_dir levels=1:2 keys_zone=cache_one:200m inactive=2d max_size=10g;
proxy_cache_valid 200 304 4h;
There will be a large data transfer only when it runs at the first time.I am sure the data transfer will reduced when the cache is ready.
THX .
--------------------------------------
Hello,
Before we consider such a change, have you tried adjusting the settings on nginx to reduce the number of initial connections while it is building the cache? It seems much more reasonable to adjust these settings so the issue does not occur in the first place and you do not have a negative impact on our other customers who reside on that shared server.
Sincerely,
Jon S.
Linux Systems Administrator
HostGator.com LLC
http://support.hostgator.com
话说回来,nginx和后端的连接数要怎么限制啊,我尝试从前端apachebench测试一下hg连接数上线,100都到不了,搞不来嘛 |
|