AWS Elastic Beanstalk
Developer Guide

Serving Static Files

To improve performance, you can configure the proxy server to serve static files (for example, HTML or images) from a set of directories inside your web application. When the proxy server receives a request for a file under the specified path, it serves the file directly instead of routing the request to your application.

To configure the proxy server to serve static files

  1. Open the Elastic Beanstalk console.

  2. Navigate to the management page for your environment.

  3. Choose Configuration.

  4. On the Software configuration card, choose Modify.

  5. In the Static files section, enter a path for serving static files and the directory of the static files to serve into the empty row at the bottom of the list.

    Start the path with a slash (/). Specify a directory name in the root of your application's source code; don't start it with a slash.

    When you add a mapping, an extra row appears in case you want to add another one. To remove a mapping, click the Remove icon.

    
          Static file configuration in the Modify software configuration page of the Elastic Beanstalk console

    If you aren't seeing the Static files section, you have to add at least one mapping by using a configuration file. The specific option namespace to use depends on your environment's platform. For details, see one of the following pages:

  6. Choose Apply.