Deploying to Microsoft Internet Information Server (IIS)
Internet Information Services (IIS) for Windows® Server is a flexible, secure and manageable Web server for hosting anything on the Web. From media streaming to web applications, IIS’s scalable and open architecture is ready to handle the most demanding tasks.
Prerequisites
- A Gatsby project set up. (Need help creating one? Follow the Quick Start)
Instructions
wwwroot
Deploying to IIS is a matter of running gatsby build
and copying the contents of your local public
folder to the wwwroot
folder of your IIS web server.
Caching
One important and sometimes overlooked aspect is to configure caching correctly. The following configuration will give you a good starting point in line with Gatsby’s suggested approach to caching.
- Install the IIS URL Rewrite module if it’s not already there. It’s required to define the
outboundRules
in theweb.config
given below. - Add a
web.config
file to thestatic
folder of your Gatsby project. It will be copied unchanged to thepublic
folder duringgatsby build
.
Please note that local settings you make for your web in IIS Manager change the web.config
file. You have to be careful to copy any changes to web.config
on your server back to the version in your Gatsby static
folder.
Limitations
IIS doesn’t support advanced features like SSR, DSG, or Image CDN. You can get all features and faster builds by signing up to Gatsby Cloud.