6 ms·
Nginx seems like one more layer of trouble. Why not just use Go?
by Zamicol 7y ago
Nginx seems like one more layer of trouble. Why not just use Go?
- zwarag 7y agoSsl certificate Reverse Proxy for possible load balancing?
- todotask 7y agoIf it was my case, I still undecided which reverse proxy can replace Nginx, however, there are no known performance benchmarks for Caddy 2 I could refer to. Nginx was designed to handle backend services easily and programmers from different background may not be well verse in Golang at the beginning.
- sneak 7y agoIt is generally repeated that the Go stdlib webserver is internet-facing-ok and production-ready (with appropriate timeouts being set on the http.Server), making a reverse proxy unnecessary. There are also dead-simple TLS libraries, some that will even get LE certs automatically.
- todotask 7y agoAgreed, I have recently built a web server entirely (with timeouts) in Go too and acme.sh for LE certs but I still haven't find a way to support Wordpress from Go to PHP-FPM, I'm not well verse to fix the only this part, if you have any suggestion is greatly appreciate.
- dthul 7y agoI almost always use a reverse proxy for some or all of the following: - Serving static files - Not needing to care about binding your application to a privileged port (below 1024) - SSL certificate handling - Hosting several applications on the same IP For a minimal development setup you might not need it though, depends on what you want to do I guess.
- tlarkworthy 7y agoYes nginx is great to bundle in early
- aphextron 7y ago> "I almost always use a reverse proxy for some or all of the following: - Serving static files - Not needing to care about binding your application to a privileged port (below 1024) - SSL certificate handling - Hosting several applications on the same IP" All of this should be handled at a higher level with load balancers doing your SSL termination, and CDN for static files. There's no reason your application server should care about any of that stuff.
- rbjorklin 7y agoWhich is why s/he is using Nginx to simulate that in the dev environment if I’m not misunderstanding?
- dthul 7y agoI mostly work on small scale stuff. There is nothing to load balance if you only have one machine :D And for development you probably don't want to use a CDN. Edit: it just occurred to me that a load balancer is nothing but a reverse proxy anyway. Running on a different machine usually, but not really different from nginx on the local machine from the point of view of the application software.
- charlesworth91 7y agoI came up on this issue, I think the main problem is as React-Router is being used its a SPA; all front end routes need to resolve to the same index.html. Totally do-able with Go but it was a bit of a pain to get it working, I ended up wrapping the "route not found" handler with some logic to serve index for given frontend routes. nginx gets you this very quickly so I ended up using this instead.