0

I am writing a backend web api for a mobile app. It should support HTTPS. Most of my experience in .NET, but for this one I want to use Go/Golang. I have a sample service ready, now I need to make sure that it is production ready. In .NET I will just use IIS, but I have no clue what would be a good approach for Go.
Should I have nginx as reverse proxy, or I better use FastCGI ? And how to make sure that my go app is up and will run on system reboot ? should I use upstart or something similar ?

6
  • 1
    I've had good results using Nginx on top of a Go API; Nginx takes care of SSL and adding support for SPDY etc is easy. Having Nginx handle deflate/gzip, SSL will also simplify your Go API code. Commented Nov 22, 2014 at 15:07
  • Do you use nginx as reverse proxy or you run FastCGI ? And how do you keep your go application running ? Commented Nov 22, 2014 at 15:14
  • Nginx as a reverse proxy is da bomb, works great for me as well, with a workload of hundreds of sustained RPS Commented Nov 22, 2014 at 15:15
  • I know it is off topic, but what framework did you guys use ? Commented Nov 22, 2014 at 15:26
  • Reverse proxy as Not_a_Golfer says - personally I'm just using vanilla net/http Commented Nov 22, 2014 at 15:37

2 Answers 2

1

I've been using Nginx FastCGI with a Go webservice - they work well together. It's no harder to set up than HTTP reverse proxying - except for having to learn how to do it. The performance ought in principle to be a lot better, but I have no measurements to justify that hunch. My web service can work in both HTTP mode and FastCGI mode (one or other at a time), so I suppose I ought to do some benchmarking (note to self!).

If you want proper system startup (and you should), you need to learn how init scripts work. I sometimes cheat and start with an existing working script someone else wrote for a similar application and customise it to work with mine.

Sign up to request clarification or add additional context in comments.

Comments

0

I've used nginx as a reverse proxy for my Go projects. I've found that it's a lot easier to set up useful server settings such as TLS, compression, etc., in nginx rather than as a pure Go server.

Keeping it alive on server reboot is a more complicated question. I would suggest learning how to write a script/whatever for your server's init daemon and just doing it that way.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.