Score:0

Best practice to serve static files for web

cn flag

I am trying to build the following infrastructure.

  • Server 1 - DB Server
  • 2 - Web server to host the web app itself Server
  • 3 - Web server for serving web app static files (like product images, css, js etc) to relieve Server 2 load for static content and let it only process the dynamic part.

I am trying to avoid an object storage like AWS S3 or DO Spaces as I am not really interested into that so what kind of server software shall I use on Server 3 to fulfill its purpose in a good manner in terms of performance?

Thanks

ru flag
Software recommendation is typically offtopic because it's highly opinion driven. I have some ideas on this, but if you're going to be doing dynamic content you really need a full blown caching CDN, not just another 'server' for the static assets. Because otherwise you'll need to configure your site with *multiple* domain interactions on the website code side of things - static assets in one domain, the rest in the normal domain.
Adrian George avatar
cn flag
@ThomasWard Yes. I can easily configure the ADMIN part of the website to handle files management on a remote server (Server 3), and the CLIENT part to serve the files from a subdomain like assets.domain.com . I am not really interested in a CDN because the website users are located in one single country. But on the top of the assets.domain.com, I would use a CDN like Cloudflare .
ru flag
Then ignoring points 1 and 2, because you seem to have that figured out, how does your *site* want you to handle static assets? S3-style integration? (hint: there are self-hosted S3-style storage solutions out there that're free!) Direct SFTP/FTP/SSH? How you set up *that* static assets server is going to be entirely dependent on your site and what it can accept and handle.
Adrian George avatar
cn flag
@ThomasWard I was not interested in S3-style storage. The ADMIN (Server 4) File Manager would be programmed to upload / manage files directly on Server 3 which is solely responsible for files storage and serving them. The idea is that the web servers must be Apache due to some specific things the application requires (Server 2 and 4, admin and client). But the files servers I was opting for NGINX as it seems to serve files much better than Apache, and here I am stuck on this decision. And I was curios if there are any other alternatives of Nginx / Apache (except Lightspeed)
ru flag
Apache and NGINX are the two main ones. There's lighttpd and others, but APache and NGINX own the market shares.
Adrian George avatar
cn flag
@ThomasWard that clear. But in terms of architecture and choosing to store the static files under a subdomain on a different server, do you think is a good practice and helpful in terms of perfomance overall? Secondly, I think this would help me to easily load balance the client app by instantinting multiple web server behing a load balancer, without the need to replicate all static files using a NFS server/client
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.