/ src / reference / deploying-to-production.md
deploying-to-production.md
 1  # Deploying Rust and WebAssembly to Production
 2  
 3  > **⚡ Deploying Web applications built with Rust and WebAssembly is nearly
 4  > identical to deploying any other Web application!**
 5  
 6  To deploy a Web application that uses Rust-generated WebAssembly on the client,
 7  copy the built Web application's files to your production server's file system
 8  and configure your HTTP server to make them accessible.
 9  
10  ## Ensure that Your HTTP Server Uses the `application/wasm` MIME Type
11  
12  For the fastest page loads, you'll want to use [the
13  `WebAssembly.instantiateStreaming` function][instantiateStreaming] to pipeline
14  wasm compilation and instantiation with network transfer (or make sure your
15  bundler is able to use that function). However, `instantiateStreaming` requires
16  that the HTTP response has the `application/wasm` [MIME type][] set, or else it
17  will throw an error.
18  
19  * [How to configure MIME types for the Apache HTTP server][apache-mime]
20  * [How to configure MIME types for the NGINX HTTP server][nginx-mime]
21  
22  [instantiateStreaming]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/instantiateStreaming
23  [MIME type]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types
24  [apache-mime]: https://httpd.apache.org/docs/2.4/mod/mod_mime.html#addtype
25  [nginx-mime]: https://nginx.org/en/docs/http/ngx_http_core_module.html#types
26  
27  ## More Resources
28  
29  * [Best Practices for Webpack in Production.][webpack-prod] Many Rust and
30    WebAssembly projects use Webpack to bundle their Rust-generated WebAssembly,
31    JavaScript, CSS, and HTML. This guide has tips for getting the most out of
32    Webpack when deploying to production environments.
33  * [Apache documentation.][apache] Apache is a popular HTTP server for use in
34    production.
35  * [NGINX documentation.][nginx] NGINX is a popular HTTP server for use in
36    production.
37  
38  [webpack-prod]: https://webpack.js.org/guides/production/
39  [apache]: https://httpd.apache.org/docs/
40  [nginx]: https://docs.nginx.com/nginx/admin-guide/installing-nginx/installing-nginx-open-source/