Windows/IIS
Setting Up an IIS Website
NOTE:
For the purposes of this walkthrough, we are assuming you're using
assets.portal.local
as your Snipe-IT local domain name. This should be changed for your own installation.
- Extract Snipe-IT to
C:\inetpub\wwwroot\snipe-it
(folder name can be changed but we will reference it as is shown here) - Run IIS Manager
- Right Click
Sites
andAdd Website
(See settings below) - Click
OK
Site name: Snipe IT
Physical path: C:\inetpub\wwwroot\snipe-it\public
Binding
Type: http
IP address: All Unassigned or a specific IP if you have one you will be using
Port: 80 or any you wish to use
Host name: assets.portal.local
Your site will now appear in the list.
Enable Additional HTTP verbs for api and frontend usage
IIS may not enable the DELETE, PUT, or PATCH verb by default. The following steps are necessary:
See #5034 for further details
- Enter IIS Manager
- Select your site.
- Open "Handler Mappings"
- Select PHP mappings (there may be more than one) and open it.
- Click on "Request Restrictions" and select the "Verbs" Tab
- Add DELETE,PUT,PATCH to the list of verbs so that it reads "GET,HEAD,POST,DELETE,PUT,PATCH"
- Save the changes.
- Do this for all php mappings listed.
Fix Permissions
Add permissions for the IIS user for the uploads
folder:
- Go to
C:\inetpub\wwwroot\snipe-it\public
- Right Click
uploads
Properties - Go to the Security Tab Edit
- Click Add and change location to local machine
- Type IUSR in object name box
- Click OK
- Give IUSR full control
- Click OK twice
Add permissions for the IIS user for the cache
folder:
- Go to
C:\inetpub\wwwroot\snipe-it\bootstrap
- Right Click
cache
Properties - Go to the Security Tab Edit
- Click Add and change location to local machine
- Type IUSR in object name box
- Click OK
- Give IUSR full control
- Click OK twice
Add permissions for the IIS user for the storage
folder:
- Go to
C:\inetpub\wwwroot\snipe-it\
- Right Click
storage
Properties - Goto Security Tab Edit
- Click Add and change location to local machine
- Type IUSR in object name box
- Click OK
- Give IUSR modify permissions
- Click OK twice
Add permissions for the IIS user for the Windows Temp
folder:
- Go to
C:\Windows\
- Right Click
temp
Properties - Go to the Security Tab Edit
- Click Add and change location to local machine
- Type IUSR in object name box
- Click OK
- Give IUSR modify permissions
- Click OK twice
NOTE:
Previous versions of Snipe-IT on IIS required you to import the .htaccess file to create the rewrite rules, however v3.0 and higher include a web.config file that handles those rules for you, so that step is no longer necessary.
Set Additional Handler Mappings
Since Snipe-IT consumes its own API in some cases, you'll need to add additional Handler Mappings for some lesser-known HTTP verbs.
- Enter IIS Manager
- Select your site
- Open
Handler Mappings
Select a PHP mapping (there may be more than one) and open it:
Click on Request Restrictions
- Select the
Verbs
Tab - Add
DELETE,PUT,PATCH
to the list of verbs so that it readsGET,HEAD,POST,DELETE,PUT,PATCH
Save the changes.
If you receive this error...
... then add double quotes around the Executable (optional): field
Click Yes for Fast-CGI message:
Repeat for all remaining php mappings listed.
Much to @madd15 for writing up the original Windows installation guide, and to @colinerd for the screenshots and documentation on the Handler Mappings.
Backup & Windows Environments
/admin/backup
and CLI php artisan snipeit:backup
require the following additional changes to be made in order to create the MySQL backup files:
- IUSR permissions on
C:\windows\temp
- path to mysqldump.exe in the .env file's
DB_DUMP_PATH=
The path placed within the .env file MUST be "old-school" DOS 8.3 compliant in order for mysqldump.exe
to work. This means the process will fail if there are any spaces in a path such as:
C:\Program Files\MySql\MySQL Server 5.7\bin
To make this path 8.3 compliant, use this script:
cmd /c for %A in ("C:\Program Files\MySql\MySQL Server 5.7\bin") do @echo %~sA
Which will output a path similar to:
C:\Progra~1\MySQL\MySQL~2.7\bin
As with any Windows path, we have to double-up on the \
when adding it to the .env. The end result will look like:
DB_DUMP_PATH=C:\\Progra~1\\MySQL\\MySQL~2.7\\bin
With the above steps done, you may now test it via a console command. Open a cmd
prompt:
cd \Inetpub\wwwroot\snipe-it
php artisan snipeit:backup
These backups are located in storage/apps/backup/
, and are also manageable via your site via [Snipe-URL]/admin/backups.
SAML - OpenSSL.cnf
In Windows Server or Azure App Services, if you receive the error "openssl.cnf is missing/invalid" when attempting to use SAML integration, you may need to add the path to OpenSSL.cnf to your System Environment Variable. This will be located in different locations depending on how OpenSSL is installed on your system. See this PHP note on installing OpenSSL https://www.php.net/manual/en/openssl.installation.php
PHP will search for the openssl.cnf using the following logic:
the OPENSSL_CONF environmental variable, if set, will be used as the path (including filename) of the configuration file.
the SSLEAY_CONF environmental variable, if set, will be used as the path (including filename) of the configuration file.
The file openssl.cnf will be assumed to be found in the default certificate area, as configured at the time that the openssl DLL was compiled. This is usually means that the default filename is C:\Program Files\Common Files\SSL\openssl.cnf (x64) or C:\Program Files (x86)\Common Files\SSL\openssl.cnf (x86), or, prior to PHP 7.4.0, C:\usr\local\ssl\openssl.cnf.
Serving WebP images on IIS
In certain configurations, WebP images won't load. In order to resolve this, you'll need to add the mime type to IIS for WebP images. You can learn more about that here: https://www.itnota.com/serving-webp-image-iis/
Updated over 2 years ago