Pregunta

I'm planning on converting an ASP.NET MVC web site to ServiceStack Razor, with the aim of hosting it on a Linux server.

What would be the best solution for serving the static content of the site? Would a self hosted daemon behind Nginx be OK, or should I use Nginx to serve that directly? What are the benefits/disadvantages with using Mono FastCGI?

¿Fue útil?

Solución

If you have an opportunity to, serve static files with nginx, that would always be the most efficient option.

It's also what www.servicestack.net does with a lot of their Live Demo's.

Otros consejos

I agree with mythz, and do this too, however you should also consider allowing caching of these static files to speed up browsing for your clients and reduce load on your servers.

In my nginx configuration, I define the common static types to serve up directly (allowing browser side caching), and then version all references to those types with a version query string to force refreshes when new copies are needed (i.e., /style.css?version=2)

Example:

location ~* \.(htm|html|jpg|jpeg|png|ico|txt|css|js|ico|pdf|gif|ttf|woff|svg|pdf)$ {
     #server it directly, but allow caching
     expires 30d;
}
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top