<p>I used Apache in the past, for hosting PHP websites. I know very little about NGINX but from what I understand it's also a web/mail server. </p>
<p>How do most developers use Go on the server, do they install the web server software together with the Go program, or do they use the stdlib http/smtp server? </p>
<p>What are the pros and cons of using full web servers like Apache and using only the Go libraries?</p>
<hr/>**评论:**<br/><br/>justinisrael: <pre><blockquote>
<p>I used Apache in the past, for hosting PHP websites. I know very little about NGINX but from what I understand it's also a web/mail server. </p>
</blockquote>
<p>Nginx uses an asynchronous model for serving requests which gives it better performance than Apache for certain use cases. It has historically had extremely good capabilities for serving static content, or tons of connections without the memory overhead of tons of threads to service them. </p>
<blockquote>
<p>How do most developers use Go on the server, do they install the web server software together with the Go program, or do they use the stdlib http/smtp server? </p>
</blockquote>
<p>Go has a stdlib which contains a production grade net package. It can be used directly as a web server without the need for a reverse proxy. That is, many people simply copy a binary to a server and start it on a port. But others may have reasons for putting a Go server behind a reverse proxy (Apache, nginx, Caddy) </p>
<blockquote>
<p>What are the pros and cons of using full web servers like Apache and using only the Go libraries?</p>
</blockquote>
<p>A Go binary can be a full web server on its own without Apache. But if you need to proxy requests to different applications, then maybe a dedicated web server like Apache, nginx, caddy, or other may be desirable to you. Maybe a particular server has very good caching and serving of static content. Or you want to use a load balancer in front of multiple instances of a server. Or you want to handle authentication or encryption before your Go application. </p></pre>DanChm: <pre><p>Thanks, this is great.
Cleared things up.</p></pre>
