# A web server vs. an app server

DevFeed: [A web server vs. an app server](<https://devfeed.tech/articles/a-web-server-vs-an-app-server-26266.md>)

Original publisher: [Read original article](<https://www.justinweiss.com/articles/a-web-server-vs-an-app-server/>)

Author: Justin Weiss

Published: 2015-07-15T07:13:18Z

Content type: tutorial

Language: en

Sources: [Justin Weiss](<https://devfeed.tech/sources/justin-weiss.md>)

Topics: [Rails](<https://devfeed.tech/topics/rails.md>), [servers](<https://devfeed.tech/topics/servers.md>), [Deployment](<https://devfeed.tech/topics/deployment.md>), [nginx](<https://devfeed.tech/topics/nginx.md>), [SSL](<https://devfeed.tech/topics/ssl.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [deploy](<https://devfeed.tech/tags/deploy.md>), [deployment](<https://devfeed.tech/tags/deployment.md>), [nginx](<https://devfeed.tech/tags/nginx.md>), [rails](<https://devfeed.tech/tags/rails.md>), [server](<https://devfeed.tech/tags/server.md>), [software](<https://devfeed.tech/tags/software.md>), [ssl](<https://devfeed.tech/tags/ssl.md>)

## AI overview

This tutorial explains the difference between web servers and application servers in a Rails deployment. It describes how web servers such as Nginx and Apache handle requests, static assets, SSL, and forwarding, while application servers run the Rails application and manage requests in production.

## Source excerpt

When you research how to deploy your Rails app, you'll see a lot of names: Apache, Unicorn, Puma, Phusion Passenger, Nginx, Rainbows, and many more. They all seem to fit under the "deploying Rails" category of software, but there's a key difference between them. Some are "web servers," and others are "app servers." Once you understand which is which, and where each category fits in your system, deployment will make a lot more sense. But the categories aren't always clear. What's a web server, and how is it different than an app server? Can you use one without the other? And where does Rack fit in? What's a web server? A web server is a program that takes a request to your website from a user and does some processing on it. Then, it might give the request to your Rails app. Nginx and Apache are the two big web servers you'll run into. If the request is for something that doesn't change often, like CSS, JavaScript, or images, your Rails app probably doesn't need to see it. The web server can handle the request itself, without even talking to your app. It'll usually be faster that way. Web servers can handle SSL requests, serve static files and assets, compress requests, and do lots of other things that almost every website needs. And if your Rails app does need to handle a request, the web server will pass it on to your app server. What's an app server? An app server is the thing that actually runs your Rails app. Your app server loads your code and keeps your app in memory. When your app server gets a request from your web server, it tells your Rails app about it. After your app is done handling the request, the app server sends the response back to the web server (and eventually to the user). You can run most app servers by themselves, without a web server in front of it. That's probably what you do in development mode! In production, though, you'll usually have a web server in front. It'll handle multiple apps at once, render your assets faster, and deal with a lot