手机浏览 RSS 2.0 订阅 膘叔的简单人生 , 腾讯云RDS购买 | 超便宜的Vultr , 注册 | 登陆

using NGINX or not?

首页 > Go >

 有人在stackoverflow上面提问:

http://stackoverflow.com/questions/17776584/webserver-for-go-golang-webservices-using-nginx-or-not
  1. I am writing some webservices returning JSON data, which have lots of users.    
  2. Would you recommend to use NGINX as a webserver or it is good enough to use the standard http server of Go?  

于是有人就回答了:

XML/HTML代码
  1. It depends.  
  2.   
  3. Out of the box, putting nginx in front as a reverse proxy is going to give you:  
  4.   
  5. Access logs  
  6. Error logs  
  7. Easy SSL termination  
  8. SPDY support  
  9. gzip support  
  10. Easy ways to set HTTP headers for certain routes in a couple of lines  
  11. Very fast static asset serving (if you're serving off S3/etc. though, this isn't that relevant)  
  12. The Go HTTP server is very good, but you will need to reinvent the wheel to do some of these things (which is fine: it's not meant to be everything to everyone).  
  13.   
  14. I've always found it easier to put nginx in front—which is what it is good at—and let it do the "web server" stuff. My Go application does the application stuff, and only the bare minimum of headers/etc. that it needs to. Don't look at putting nginx in front as a "bad" thing.  

还有人回答:

XML/HTML代码
  1. The standard http server of Go is fine. If your application mostly/only are "dynamic" requests/responses, then it's really the best way.  
  2.   
  3. You could use nginx to serve static assets, but most likely the standard Go one is fine for that, too. If you need higher performance you should just use a CDN or cache as much as you can with Varnish (for example).  
  4.   
  5. If you need to serve different applications off the same IP address, nginx is a fine choice for a proxy to distribute requests between the different applications; though I'd more often get Varnish or HAProxy out of the toolbox for that sort of thing.  

这回你觉得呢?你还会用nginx吗?还是只用go做http server/???




本站采用创作共享版权协议, 要求署名、非商业和保持一致. 本站欢迎任何非商业应用的转载, 但须注明出自"易栈网-膘叔", 保留原始链接, 此外还必须标注原文标题和链接.

Tags: nginx, go

« 上一篇 | 下一篇 »

只显示10条记录相关文章

yii:Apache and Nginx configurations (浏览: 21992, 评论: 0)
Nginx针对IP和目录限速 (浏览: 21090, 评论: 0)
Nginx下zend framework的设置 (浏览: 20524, 评论: 0)
Lnmp一键安装 (浏览: 20088, 评论: 0)
转一下:OpenResty (浏览: 18938, 评论: 0)
对着谢大的教程写代码(一) (浏览: 16856, 评论: 0)
nginx 的resolv.conf经常被自动清空 (浏览: 15558, 评论: 1)
开发中的一些注意事项 (浏览: 15550, 评论: 0)
用nginx proxy模式后,提交POST出错 (浏览: 15442, 评论: 0)
上海首届GO聚会开始了 (浏览: 14113, 评论: 0)

发表评论

评论内容 (必填):