snipe / snipe-it

A free open source IT asset/license management system
https://snipeitapp.com
GNU Affero General Public License v3.0
11.02k stars 3.18k forks source link

Snipe-It Installation on IIS (confusing at best) #2883

Closed brudnicke closed 7 years ago

brudnicke commented 7 years ago

Is there a clear, concise, step by step install guide for making Snipe-It work on Windows Server 2012 using IIS? I'm finding bits and pieces here, but they are referencing PHP, database, etc, and no where does it show where I get these programs, what versions, when/where to install.

The IIS setup document only tells me how to create the site, and adjust permissions. The dependencies page only states to download and run composer from the snipe-it directory. That program is asking for some type of PHP command.

JExactly commented 7 years ago

@brudnicke you need to install PHP and a database app. These can be installed in IIS from the Micorsoft Web Platform (https://www.microsoft.com/web/downloads/platform.aspx) Install the platform installer so that you can add PHP (PHP 7 should work fine), MySQL 5.5 etc.. additionally, once PHP is installed, you will have PHP Manager appear in your IIS Manager, You can enable there as well as enable additional PHP extensions that are needed as referenced in the install guide.

Hope this helps!

brudnicke commented 7 years ago

Thanks for the information. Was able to find the step by step requirements. However, when i try to access the site, it doesn't come up. Standard "The website cannot display the page". I've restarted IIS, and the server, but with no luck.

JExactly commented 7 years ago

Did you make sure to apply your hostname to the .env file you are accessing from. Also, did you make sure you added a DNS record as well for your server in your DNS entries? Additionally make sure you set your bind address to the IP for your host server in IIS

brudnicke commented 7 years ago

Not sure where I put a host name in the .env file. Not seeing a reference to it. As for DNS, I’ve created a record “snipeit” pointing to 10.10.199.12 (IP of website). I’ve tried accessing the site at http://10.10.199.12 and http://snipeit , but each of them comes up with HTTP ERROR 500.

When I added the hostname snipeit.corp.domain.com to the bindings, when I try to hit the website, it brings up the generic IIS page.

Here is the .env file:

--------------------------------------------

REQUIRED: BASIC APP SETTINGS

--------------------------------------------

APP_ENV=production APP_DEBUG=false APP_KEY=ChangeMe APP_URL=null APP_TIMEZONE='UTC' APP_LOCALE=en

--------------------------------------------

REQUIRED: DATABASE SETTINGS

--------------------------------------------

DB_CONNECTION=mysql DB_HOST=localhost DB_DATABASE=null DB_USERNAME=root DB_PASSWORD=password DB_PREFIX=null DB_DUMP_PATH='C:\PROGRA~1\MARIAD~10.1\bin'

--------------------------------------------

REQUIRED: OUTGOING MAIL SERVER SETTINGS

--------------------------------------------

MAIL_DRIVER=smtp MAIL_HOST=10.10.199.70 MAIL_PORT=587 MAIL_USERNAME=null MAIL_PASSWORD=null MAIL_ENCRYPTION=null MAIL_FROM_ADDR=ithelpdesk@domain.com MAIL_FROM_NAME='Snipe-IT' MAIL_REPLYTO_ADDR=ithelpdesk@domain.com MAIL_REPLYTO_NAME='Snipe-IT'

--------------------------------------------

REQUIRED: IMAGE LIBRARY

This should be gd or imagick

--------------------------------------------

IMAGE_LIB=gd

--------------------------------------------

OPTIONAL: SESSION SETTINGS

--------------------------------------------

SESSION_LIFETIME=12000 EXPIRE_ON_CLOSE=false ENCRYPT=false COOKIE_NAME=snipeit_session COOKIE_DOMAIN=null SECURE_COOKIES=false

--------------------------------------------

OPTIONAL: CACHE SETTINGS

--------------------------------------------

CACHE_DRIVER=file SESSION_DRIVER=file QUEUE_DRIVER=sync

--------------------------------------------

OPTIONAL: AWS S3 SETTINGS

--------------------------------------------

AWS_SECRET=null AWS_KEY=null AWS_REGION=null AWS_BUCKET=null

--------------------------------------------

OPTIONAL: MISC

--------------------------------------------

APP_LOG=single APP_LOCKED=false FILESYSTEM_DISK=local APP_TRUSTED_PROXIES=192.168.1.1,10.0.0.1 ALLOW_IFRAMING=false

The information including any attachments contained in this document is confidential and is for the use only of the intended recipient. If you are not the intended recipient, you should notify the sender and delete this message immediately. Any distribution, disclosure, or copying of this message, or the taking of any action based on its contents is strictly prohibited.

Birkey’s Farm Store, Inc.

JExactly commented 7 years ago

1) Make sure to apply your hostname(APP_URL=yourhostname.com) in the .env file.

2.) Make sure you added a DNS record as well for your server in your DNS entries.

Additionally make sure you set your bind address to the IP for your host server in IIS.

One other thing. Make sure you have assigned the proper permissions as noted on this page for all the correct folders listed. https://snipe-it.readme.io/v3.0/docs/windowsiis

brudnicke commented 7 years ago
  1. I’ve added the hostname per instructions. I’ve also setup the hostname in DNS, and checked that it’s resolving correctly. I edited the bindings on IIS, and set the host name. Bind is set to the IP address on the servers second network card. I’ve verified the permissions on all the folders as suggested in the document url provided.

Site won’t respond.

The information including any attachments contained in this document is confidential and is for the use only of the intended recipient. If you are not the intended recipient, you should notify the sender and delete this message immediately. Any distribution, disclosure, or copying of this message, or the taking of any action based on its contents is strictly prohibited.

Birkey’s Farm Store, Inc.

JExactly commented 7 years ago

after you made all changes. did you restart IIS? or at leaset restart the single site in IIS

brudnicke commented 7 years ago

Yes. Using the IISRESET command.

The information including any attachments contained in this document is confidential and is for the use only of the intended recipient. If you are not the intended recipient, you should notify the sender and delete this message immediately. Any distribution, disclosure, or copying of this message, or the taking of any action based on its contents is strictly prohibited.

Birkey’s Farm Store, Inc.

brudnicke commented 7 years ago

Not sure if this makes a difference, but I ran the php artisan key:generate command, but the key is still set to ChangeMe in the .env file.

The information including any attachments contained in this document is confidential and is for the use only of the intended recipient. If you are not the intended recipient, you should notify the sender and delete this message immediately. Any distribution, disclosure, or copying of this message, or the taking of any action based on its contents is strictly prohibited.

Birkey’s Farm Store, Inc.

JExactly commented 7 years ago

that makes a big difference. Yes, that key is important. You have created a copy of .env.example and made your changes and saved it as .env only correct? You should also be able to take the appkey and manually add it to your .env file. I would restart your site after that.

brudnicke commented 7 years ago

Yes. I’m working with a .env file. I’m using Notepad+++ to edit and save it.

Does it store the key somewhere after you run the command. I enter the command, and it just goes right back to a command promp.t

The information including any attachments contained in this document is confidential and is for the use only of the intended recipient. If you are not the intended recipient, you should notify the sender and delete this message immediately. Any distribution, disclosure, or copying of this message, or the taking of any action based on its contents is strictly prohibited.

Birkey’s Farm Store, Inc.

JExactly commented 7 years ago

Yes, it is supposed to write the key automatically to the .env file. Are you running php artisan key:generate in the command prompt while inside of your snipeit directory?

brudnicke commented 7 years ago

Yes. Should it be run from an elevated command prompt?

The information including any attachments contained in this document is confidential and is for the use only of the intended recipient. If you are not the intended recipient, you should notify the sender and delete this message immediately. Any distribution, disclosure, or copying of this message, or the taking of any action based on its contents is strictly prohibited.

Birkey’s Farm Store, Inc.

JExactly commented 7 years ago

I would, to make sure you have write access to the directory when the command is run.

brudnicke commented 7 years ago

I tried using the elevated command prompt, but it did not change the file.

I confirmed the security again. The file also has everyone with full control.

The information including any attachments contained in this document is confidential and is for the use only of the intended recipient. If you are not the intended recipient, you should notify the sender and delete this message immediately. Any distribution, disclosure, or copying of this message, or the taking of any action based on its contents is strictly prohibited.

Birkey’s Farm Store, Inc.

JExactly commented 7 years ago

manually copy the key it generates on the screen to the .env save and restart IIS

brudnicke commented 7 years ago

It’s not generating a key (at least it’s not displaying one on the screen).

From: JExactly [mailto:notifications@github.com] Sent: Wednesday, November 09, 2016 2:17 PM To: snipe/snipe-it Cc: Brian Rudnicke; Mention Subject: Re: [snipe/snipe-it] Snipe-It Installation on IIS (confusing at best) (#2883)

manually copy the key it generates on the screen to the .env save and restart IIS

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/snipe/snipe-it/issues/2883#issuecomment-259515012, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AWLwtrafc7jJgYqHIldHFK_hctw4HpJsks5q8ipBgaJpZM4Kpjlt.

The information including any attachments contained in this document is confidential and is for the use only of the intended recipient. If you are not the intended recipient, you should notify the sender and delete this message immediately. Any distribution, disclosure, or copying of this message, or the taking of any action based on its contents is strictly prohibited.

Birkey’s Farm Store, Inc.

JExactly commented 7 years ago

I am currently out of ideas, Maybe someone else has some additional ideas

snipe commented 7 years ago

If it's not displaying a key, something else is wrong. Check your laravel log file after you run the key generation and see if anything shows up

JExactly commented 7 years ago

@snipe Maybe he didn't get composer installed properly and he is missing some dependencies?

brudnicke commented 7 years ago

Where is the laravel log located?

The information including any attachments contained in this document is confidential and is for the use only of the intended recipient. If you are not the intended recipient, you should notify the sender and delete this message immediately. Any distribution, disclosure, or copying of this message, or the taking of any action based on its contents is strictly prohibited.

Birkey’s Farm Store, Inc.

JExactly commented 7 years ago

@brudnicke the laravel log is located in /inetpub/www/%yoursnipeitdirectory%/storage/logs.

i was wondering, did you get composer installed in your snipe-it directory and run the composer commands to install all the dependencies?

brudnicke commented 7 years ago

There is no log there.

I did download and run composer from the snipe-it directory. It went through something (no prompts) and then it was finished.

The information including any attachments contained in this document is confidential and is for the use only of the intended recipient. If you are not the intended recipient, you should notify the sender and delete this message immediately. Any distribution, disclosure, or copying of this message, or the taking of any action based on its contents is strictly prohibited.

Birkey’s Farm Store, Inc.

JExactly commented 7 years ago

Open an administrative command prompt, navigate into your snipe-it directory and run this command: composer install --no-dev --prefer-source once that run, it will install all your dependencies

brudnicke commented 7 years ago

Result output:

E:\Sites\Snipe-It>composer install --no-dev --prefer-source Loading composer repositories with package information Installing dependencies from lock file Your requirements could not be resolved to an installable set of packages.

Problem 1

E:\Sites\Snipe-It>

The information including any attachments contained in this document is confidential and is for the use only of the intended recipient. If you are not the intended recipient, you should notify the sender and delete this message immediately. Any distribution, disclosure, or copying of this message, or the taking of any action based on its contents is strictly prohibited.

Birkey’s Farm Store, Inc.

JExactly commented 7 years ago

You need to make sure any extensions that are required are enabled. looks like it's only missing PHP fileinfo extension.

Open IIS Manager, open up PHP Manager. Under PHP Extensions, enable php_fileinfo.dll. restart IIS for safe measure, rerun the command again.

You need to make sure all PHP extensions that are required are installed and enabled. These were listed under requirements in the hlp documentation here: https://snipe-it.readme.io/docs/requirements That lists all required PHP extensions that need to be enabled. Also, enable php_gd2, this is the GD Library exttension that is needed as well.

Enable all required that are not already while you are in there, enabling fileinfo.

brudnicke commented 7 years ago

Lots of progress. Thanks. The extensions in question are installed. I was able to generate a key and it was placed in the .env file.

When I try to hit the site now, it come ups to /setup with the error 404 – Directory Not Found.

The information including any attachments contained in this document is confidential and is for the use only of the intended recipient. If you are not the intended recipient, you should notify the sender and delete this message immediately. Any distribution, disclosure, or copying of this message, or the taking of any action based on its contents is strictly prohibited.

Birkey’s Farm Store, Inc.

JExactly commented 7 years ago

did you make sure to set your directory permissions for IIS as documented here: https://snipe-it.readme.io/v3.0/docs/windowsiis ?

JExactly commented 7 years ago

Additionally, Make sure that under your sites Advanced settings in IIS, that your public directory is your physical path for exaple: C:\inetpub\wwwroot\%snipeitdirectory%\public

brudnicke commented 7 years ago

Yes. I just re-verified, and the permissions are set as specified in that article.

The information including any attachments contained in this document is confidential and is for the use only of the intended recipient. If you are not the intended recipient, you should notify the sender and delete this message immediately. Any distribution, disclosure, or copying of this message, or the taking of any action based on its contents is strictly prohibited.

Birkey’s Farm Store, Inc.

brudnicke commented 7 years ago

More Info (it’s looking for a setup directory that does not exist under public)

Detailed Error Information:

Module IIS Web Core

Notification MapRequestHandler

Handler StaticFile

Error Code 0x80070002

Requested URL http://snipeit.corp.birkeys.com:80/setup

Physical Path E:\Sites\Snipe-It\public\setup

Logon Method Anonymous

Logon User Anonymous

The information including any attachments contained in this document is confidential and is for the use only of the intended recipient. If you are not the intended recipient, you should notify the sender and delete this message immediately. Any distribution, disclosure, or copying of this message, or the taking of any action based on its contents is strictly prohibited.

Birkey’s Farm Store, Inc.

brudnicke commented 7 years ago

It is set correctly.

The information including any attachments contained in this document is confidential and is for the use only of the intended recipient. If you are not the intended recipient, you should notify the sender and delete this message immediately. Any distribution, disclosure, or copying of this message, or the taking of any action based on its contents is strictly prohibited.

Birkey’s Farm Store, Inc.

JExactly commented 7 years ago

https://snipe-it.readme.io/docs/common-issues#the-requested-url-setup-was-not-found-on-this-serv

Import the .htaccess rules into IIS URL rewrite. all should be good. There will be an error for one of the rules. that is ok

JExactly commented 7 years ago

I'm pretty sure this will resolve it for you.

brudnicke commented 7 years ago

I tried importing that one before, and I keep getting the rule error. However, it will not let me save. It keeps giving me the error (The data is the page is invalid. Correct the data and try again.).

The information including any attachments contained in this document is confidential and is for the use only of the intended recipient. If you are not the intended recipient, you should notify the sender and delete this message immediately. Any distribution, disclosure, or copying of this message, or the taking of any action based on its contents is strictly prohibited.

Birkey’s Farm Store, Inc.

JExactly commented 7 years ago

I have attached a modified version. Use this for your import htaccessSnipeIT.zip

JExactly commented 7 years ago

you have to remove the entry that has the issue. it doesn't apply to IIS AFAIK

brudnicke commented 7 years ago

It doesn’t identify the offending string.

Options -MultiViews ``` # Make sure .env files not not browseable if in a sub-directory. Deny from all ```

The information including any attachments contained in this document is confidential and is for the use only of the intended recipient. If you are not the intended recipient, you should notify the sender and delete this message immediately. Any distribution, disclosure, or copying of this message, or the taking of any action based on its contents is strictly prohibited.

Birkey’s Farm Store, Inc.

JExactly commented 7 years ago

in the file I attached, I have removed the string already.

brudnicke commented 7 years ago

Apologies. I didn’t see the attachment. I downloaded and tried to import, but I received same data error.

The information including any attachments contained in this document is confidential and is for the use only of the intended recipient. If you are not the intended recipient, you should notify the sender and delete this message immediately. Any distribution, disclosure, or copying of this message, or the taking of any action based on its contents is strictly prohibited.

Birkey’s Farm Store, Inc.

JExactly commented 7 years ago

all you should have in the .htaccess is

`

Options -MultiViews
# Make sure .env files not not browseable if in a sub-directory.
<FilesMatch "\.env$">
Deny from all
</FilesMatch>

` I just tested this on my IIS server and I was able to import the file I uploaded without issue.

brudnicke commented 7 years ago

In the Rewrite Rules box:

Options -MultiViews # Make sure .env files not not browseable if in a sub-directory. Deny from all Still unable to save. Same data error. The information including any attachments contained in this document is confidential and is for the use only of the intended recipient. If you are not the intended recipient, you should notify the sender and delete this message immediately. Any distribution, disclosure, or copying of this message, or the taking of any action based on its contents is strictly prohibited. Birkey’s Farm Store, Inc.
JExactly commented 7 years ago

Were you able to successfully get this up and going?

brudnicke commented 7 years ago

Not yet. I haven’t been able to get the modified .htaccess to import in to IIS. It keeps giving me that invalid data error.

The information including any attachments contained in this document is confidential and is for the use only of the intended recipient. If you are not the intended recipient, you should notify the sender and delete this message immediately. Any distribution, disclosure, or copying of this message, or the taking of any action based on its contents is strictly prohibited.

Birkey’s Farm Store, Inc.

JExactly commented 7 years ago

You know, I totally forgot after V3 you no longer need to import the .htaccess as it is all handled with the web.config file in the public directory. I wouldn't worry about importing the url rewrite rules. However, as long as URL Rewrite is a component listed in you site components.. You should be good. The issue seems to me then would be that your default Physical path under your sites advanced settings is not set correctly.. for example: C:\inetpub\wwwroot\SNIPE-IT\public

image

brudnicke commented 7 years ago

My physical path is pointing to E:\Sites\Snipe-It\public (which is where the public folder is located). NOTE: There is no setup directory located under Public.

When opening the website, I get:

[cid:image001.png@01D23E7A.CAA21DC0]

The information including any attachments contained in this document is confidential and is for the use only of the intended recipient. If you are not the intended recipient, you should notify the sender and delete this message immediately. Any distribution, disclosure, or copying of this message, or the taking of any action based on its contents is strictly prohibited.

Birkey’s Farm Store, Inc.

JExactly commented 7 years ago

Maybe @snipe has a better answer. I am sure there is no \setup directory because URL Rewrite handles the rewrite to the correct location for the setup.

JExactly commented 7 years ago

Also, I think what I would reccommend is that your remove and re-add proper permissions for the folders and restart your IIS server and see if anything changes. As well as make sure that your .ENV file has all it's proper settings and that your mysql user has proper rights to make changes to your database

brudnicke commented 7 years ago

What should be in the web.config file? The one I have is blank.

The information including any attachments contained in this document is confidential and is for the use only of the intended recipient. If you are not the intended recipient, you should notify the sender and delete this message immediately. Any distribution, disclosure, or copying of this message, or the taking of any action based on its contents is strictly prohibited.

Birkey’s Farm Store, Inc.

JExactly commented 7 years ago

web.zip