Deploying the e-shop on IIS
This document deals with deploying the e-shop on IIS, installing its components and testing.
Before installing the E-shop itself, the following must be prepared and installed:
- IIS (Internet Information Services Manager)
- Application server
- Web services server
- PHP version 7.4.3 to 8.3.0 (64 bit)
The installation and settings of the individual components are described in detail in the following chapters.
K2 application server
This installation package is used to install the IS K2 version 3 application server. The application server then serves the web clients that connect to it. Installation of the application server is also required by the K2 tools Task scheduler and Notification.
Software requirements
The first requirement of the application server installer is that the installation must be run with administrator privileges. Since the K2 installer itself must already meet this condition, this ensures that the privilege is also passed on to all installations run from the K2 installer. To be sure, each installation tests this privilege, so if the privileges are insufficient, the installer displays a message.
The second requirement is that IS K2 must be installed, in the version corresponding to the version of the application server, at least at the level of the version release, i.e. e.g. Iris.3.
If the conditions mentioned above are met, we can start the installation.
Installation
After the installation is started, the first dialog is displayed, informing the user that the installer for the K2 Application server product has been started, and it also displays the number of the version that will be installed.

Picture: AS installation start
After pressing the Next button, we move on to the second dialog, which contains the license agreement that we must accept after reading in order to continue. We accept the agreement by checking the option I accept the terms in the license agreement.

Picture: AS license agreement
The Next button takes us to the third dialog, where the user is prompted to enter the path to the installed K2. Using the Change button, you can browse the directories on physical disks or on the network in a standard dialog.

Picture: Path to IS K2
If IS K2 is not installed in the selected directory, a warning message is displayed when trying to continue the installation, and it does not allow the installation to continue until a valid path is selected.

Picture: IS K2 not found
If a valid IS K2 installation is found in the directory, after pressing the Next button the installation continues to the next dialog, which is used to select the installation path, i.e. the path where the application will be installed. Using the Change button, you can browse the directories on physical disks in a standard dialog.

Picture: Installation directory
After selecting the installation directory and pressing the Next button, a dialog is displayed prompting the user to specify how the application server will be identified and how it will communicate with other applications. K2 web applications can communicate with the application server (and identify it) either by the instance name (named pipe) or by a specific port number. As needed, we therefore enter the instance name or the port number. Only the Web services server - K2 API version 2 and web K2 can communicate with the AS using the port number. For this reason, both access methods can be entered at the same time. Further, we enter the description of the application server, and in the Client field we enter the client for which the application server is to be the default.

Picture: Selecting communication with the application server

Picture: Application server settings
The Turn on notification option turns on notifications on the AS, i.e. the parameter "NSUSERS=K2" is added to the "K2.INI" file. The Turn on scheduler option turns on the scheduler on the AS and the parameter "SCHEDULESERVICE=1" is added to the "K2.INI" file.
If the Configure the application server also for the web services server option is checked, a dialog follows, see picture: Settings for the web services server, which prompts you to enter the anonymous user prefix, the number of users and the users' password. These users must be created in IS K2 before the AS installation and should be numbered in ascending order, e.g. AN1, AN2, etc., where AN is the prefix followed by a sequence number. All these users must have the same password.
If the Configure for e-shop option is checked, the next installation step displays the dialog Application server settings for E-shop, see picture Default contact person number for EShop. Here we enter the number of the contact person through which the anonymous e-shop user is logged in. This contact person must have a registration assigned. The "AS3ContactPerson" parameter is also added to the "K2.INI" of the application server.
If the Configure for contact centre option is checked, the application server installation also displays a dialog, see picture K2 user for contact centre. On this screen we enter the name of the user under which the contact centre runs in IS K2, as well as the password. The values entered here are then added to the "K2.INI" of the application server as the parameters "CCUSER" and "CCPASWORD". The parameter "CONTACTCENTERSERVICE=1" is also added to "K2.INI".

Picture: Settings for the web services server

Picture: Default contact person number for EShop

Picture: K2 user for contact centre
The next dialog of the installation is entering the name and password of the user under which the application server service will run. The local system account can be used, see picture Local system account - AS, or the account of a Windows user, which requires a password, see picture: Windows user 2 - AS.

Picture: Local system account - AS
A domain user with a password can also be used, see picture: Windows user 2 - AS.

Picture: Windows user 2 - AS
After pressing the Next button, the passwords are checked for a match. If they do not match, the user is prompted to correct them. The next dialog of the installation is entering the K2 user under which the application server will connect to IS K2. An already created user can be used, or a special user can be created that will be used only for connecting to the AS. The user used to connect to the AS does not need a reserved license, see picture: K2 user - AS.

Picture: K2 user - AS
After pressing the Next button, the passwords are checked for a match. If they do not match, the user is prompted to correct them.
If the passwords match, a dialog is displayed informing the user that the installation is ready. Clicking the Install button then starts the installation itself.

Picture: Installation confirmation
After a successful installation, the last dialog about the successful installation is displayed to the user, see Picture: End of installation

Picture: End of installation
At the end of the installation or reinstallation of the Application server, a text file with a list of users may be displayed. The reason is the stricter security policy for IS K2 user accounts.
Access to IS K2 from the web can be denied to individual users, and after the reinstallation all users have this access denied. At the end of the installation, the text file displays a list of all users who are linked to a contact person and at the same time have web access denied. These users will not be able to use some functions, such as approving workflow from e-mail. For these users, web access must be set in the Users - password settings book.

Picture: Text file with a list of users
The K2_AS installation automatically sets the K2_AS service to restart in case of an error. In Windows, it sets the option "Restart the Service" in the failure fields on the Recovery tab of the service. This action no longer needs to be done manually.

Picture: AS restart settings
At startup, K2_AS checks for the existence of the economize.cpu file and if it:
- Does not exist - K2_AS runs at maximum performance and memory operations run without the Sleep operation when the memory manager is locked
- Exists - the Sleep operation is called when the memory manager is locked, which reduces CPU load.
Description
This installation package is used to install the IS K2 version 3 application server. The application server then serves the web clients that connect to it.
Software requirements
Installation
IIS installation
In live operation, K2 EShop must be deployed on a server operating system – Microsoft Windows Server. The supported versions of this system are listed in the "System requirements" document for the given IS K2 version. Installation on a client operating system is possible, but only for testing or viewing a DEMO installation. This document describes the server installation of IIS and all other system components necessary for running K2 Eshop.
The next step is the installation of IIS (Internet Information Services Manager). First, it is necessary to run the Server Manager and then the option Add Roles and Features.

Picture: Server Manager
The first step contains instructions before the installation itself; after reading them, we move on to the next step with the Next button.

Picture: Add Roles and Features Wizard
In the next step, we select the installation type - Role-based or feature-based installation.

Picture: Installation type
Selecting the server on which IIS is to be installed.

Picture: Server selection
In the next step, in addition to the features checked by default, it is necessary to check the option "Web server (IIS)".

Picture: Server roles
The next step is the definition of features. We set the .NET Framework according to the installation and choice. Here it is necessary to keep the default settings and add application development (.NET 4.5, ASP.NET 4.5), Management Tools (including IIS 6 compatibility) and not to check "WebDAV Publishing".
Add: ASP.NET 4.6 and HTTP Activation (under WCF Services).

Picture: Features
In the next step, check CGI (under Application development) – it is a must for the e-shop, it is not necessary for K2 API.

Picture: Role services
In the same Role services step, IIS 6 Metabase Compatibility must also be set.

Picture: Role services
In the last step, the user only confirms the previous settings.

Picture: Installation confirmation
K2 API installation
The K2 web services server (K2 API) is a web application running on the Microsoft Internet Information Services (IIS) web server. Through the K2 application server, it provides access to the data of the K2 information system and allows scripts and reports to be run. The web services are based on the REST technique, i.e. communication takes place via the HTTP protocol and the standard methods GET (reading data), POST (creating data), PUT (modifying existing data).
Data can be read and sent either in XML or JSON format.
After entering the root URL of the K2 API in a browser, you can browse the basic description of the services and resources/operations using the dynamic help.
Installation and basic settings
Prerequisites:
- The K2 license must include at least one K2 API thread (the Number of shared users item), and a corresponding number of so-called anonymous users must be created in K2 with a login composed of the same prefix followed by a sequence number at the end (e.g. "AN1" – "AN5"). These users must have identical rights and the same password.
- An installed and running application server with "Configure the application server for the web services server" and "Configure the application server for Eshop" checked during installation. If these options were not checked during installation, the following parameters can be added to the K2.INI configuration file of an existing AS installation (example for 5 threads and users named AN1 – AN5):
- AS3USER='AN'
- AS3PASSWORD='ANPassword'
- AS3USERS=5
- AS3IO=2000034152
- AS3Contactperson=65 (number of the contact person used for access by anonymous users)
- The server on which the K2 API will be installed must have IIS available with ASP.NET and WCF support installed. When installing IIS, it is necessary to select especially these components:
- Roles: Default + Application Development (.NET 4.5, ASP.NET 4.5), Management Tools (including IIS 6 compatibility); Do not check: WebDAV Publishing
- Features: Windows Process Activation Service (Process Model), WCF Services (HTTP Activation), .NET 4.5, ASP.NET 4.5
- For an HTTPS installation, a correctly set certificate in IIS
- When publishing the K2 API for access over the internet, the used HTTP/HTTPS ports allowed (80/443 by default)
Recommended deployment for access to the K2 API from the internet:
The K2 application server should always be installed on a server accessible only from the internal network. It is recommended to install the K2 API (and any other web applications) on a separate server that is accessible from the internet and has restricted access to the internal network, allowing only communication with the K2 AS.
Installation of the K2 API:
It is performed using the K2 installer. Before the installation starts, the K2 API installation program checks the availability of the basic required components; if any components are missing, it displays a warning and the installation is stopped.
Several items of data need to be entered during the installation:
- Target directory – any directory can be selected, it does not have to be in the IIS root directory
- IIS server name – enter the name by which the server with the K2 API will be accessed. For test installations, "localhost" can also be entered – under this name, however, the K2 API will be available only on the given server.
- Web page on IIS (Web Site) – select the Web Site into which you want to install the K2 API. By default, only the "Default Web Site" is available on IIS.
- Application name on IIS – the part of the K2 API URL after the server name. If the server name is "mujserver.cz" and you enter "restservice" as the application name, the base URL for access to the K2 API will be http://mujserver.cz/restservice.
- Name or IP address of the computer where the K2 AS runs.
- K2 AS instance name – entered during the K2 AS installation.
Most common problems when installing and configuring the K2 API:
- Incorrect name or IP address of the server with the AS, or incorrect AS instance name – check and, if necessary, correct manually in the K2 API configuration file – the web.config file in the K2 API installation directory. Check that nothing is blocking network communication between the server with the K2 API and the server with the AS
- The AS is not configured for the K2 API – complete the configuration, see the Prerequisites section above
- Anonymous users are missing or disabled - see the Prerequisites section above
- The number of shared users is not specified in the K2 license, or this number is exceeded – update the K2 license
- Missing IIS components – check the IIS components, see the Prerequisites section above
- Missing permissions for the IIS process (see picture)

Picture: Missing permissions
The permissions must be added to these users.

Picture: Users
In most cases, logging of the K2 API or the AS helps. Logging of the K2 API is turned on in the web.config configuration file, with the parameters LogPath (path to the log file), LogLevel (types of messages to be logged, at least Info is recommended for debugging), LogRequests (allows you to monitor the processing of individual requests to the K2 API even when several requests run concurrently).
PHP installation
The e-shop requires the installation of PHP version 7.4.3 to 8.3.0 (64bit non-thread-safe). The PHP download link is https://windows.php.net/download/.
Note: Older versions can be found under the "Past releases" link.
Procedure:
1. Extract all files in the PHP .zip package to a folder of your choice, for example C:\Program Files\PHP\.
2. Open IIS Manager, in the left Connections pane click the hostname of your computer and then click the Handler Mappings feature.

Picture: IIS Manager - Handler Mappings
In the right Actions pane, select the Add Module Mapping action.

Picture: IIS Manager - Handler Mappings

Picture: IIS Manager - Module Mapping
- In the Request path field, enter *.php.
- From the Module menu, select FastCgiModule.
- In the Executable field, enter the full path to Php-cgi.exe, for example C:\Program Files\PHP\Php-cgi.exe.
- In the Name field, enter a name for the module mapping, for example php-7.4.14.
Confirm the mapping with the OK button.
3. In the left Connections pane, click the hostname of your computer and then click the Default Document feature.

Picture: IIS Manager - Default Document
In the right Actions pane, select the Add action.

Picture: IIS Manager - Add Default Document
In the Name field, enter index.php and click OK.

Picture: IIS Manager - Add Default Document
Note: Move the row with Index.php to the first position.
A detailed description of the PHP installation is available at learn.microsoft.com/en-us/iis/application-frameworks/scenario-build-a-php-website-on-iis/configuring-step-1-install-iis-and-php.
K2 E-shop
This installation package is used to install the K2 online store. The K2 E-shop application runs within Internet Information Services. K2 E-shop uses web services to connect to IS K2, and these in turn use the application server. The installation of K2 E-shop therefore already assumes that they exist.
Software requirements
The first prerequisite for installing K2 E-shop is the installation of Internet Information Services, hereinafter IIS, version 8.0 or higher. If IIS is not installed, a warning message is displayed at the start of the installation. Within IIS, the CGI (Common Gateway Interface) option must be checked in the Web services - Application Development Features section. This option is necessary for PHP to work within IIS.
The second requirement for K2 E-shop to work is the URL Rewrite extension of IIS. Installing this extension ensures that URLs are translated into a readable form. If this extension is not installed, the installer displays a message with a download link. The URL Rewrite installation is also included on the Other installations tab, from where it can be downloaded and installed.
Picture: Installer message (missing URL Rewrite)
The last requirement is the installation of PHP version 7.4.3 to 8.3.0 support in IIS. If this support is not installed, the installer informs you with a displayed message. The PHP installation is described in more detail in the chapter PHP installation.

Picture: Installer message (missing PHP support)
Installation
After the installation is started and the software requirements above are met, the first dialog is displayed, informing the user that the installer for the K2 E-shop product has been started, see Picture: K2 installation start.

Picture: K2 E-shop installation start
After pressing the Next button, we move on to the second dialog, which contains the license agreement.
The Next button takes us to the third dialog, which is used to select the installation path for K2 E-shop, see Picture: Target directory. Using the Change button, you can browse the directories on physical disks or on the network in a standard dialog. K2 E-shop is usually installed in the IIS home directory (the default IIS directory is C:\inetpub\wwwroot). The directory name then determines the final form of the e-shop URL, which consists of the IIS address and the name of the directory with the K2 E-shop product installation.

Picture: Target directory
After selecting the installation path, a dialog follows in which we specify the web services for the E-shop. K2 E-shop connects to IS K2 through these web services. In this dialog, we select the Log type (Http or Https), the IIS server name (usually the name of the computer where the web services are installed) and the Application name on IIS (the name of the web services for K2 E-shop). These three values form the complete URL for connecting to the web services server.

Picture: Web services for E-shop
The next dialog window is again displayed by pressing the Next button. Here it is necessary to set the login credentials for anonymous access to the e-shop. These are the login credentials set on the contact person.

Picture: Login for an unregistered user
The last installation dialog is E-shop settings. Here, in the E-shop number from K2 field, you must enter the RID of the online store from IS K2 to identify it uniquely. There is also a field for specifying the URL for access to pictures.

Picture: E-shop settings
After filling in all the data, we continue with the Next button. A dialog is displayed informing the user that the installation is ready. The Install button then starts the actual installation of the product.

Picture: K2 E-shop installation ready
After a successful installation, the last dialog with information about the result is displayed.

Picture: Completing the installation
Pictures for Eshop
Pictures are an integral part of an online store. The folder from which the online store will load pictures must be created in the same location as the online store itself. On this folder, browsing must be set to Enable in the "Directory Browsing" section.

Picture: Setting browsing of the picture folder for Eshop
Checking web server settings
Secure web server settings
To check the security of web pages, you can use the online tool Mozilla Observatory https://observatory.mozilla.org/.
Before running the test, it is advisable to check the option Force a rescan instead of returning cached results, which clears the browser cache.

Picture: Mozilla Observatory
After entering the e-shop URL, e.g. https://demoshop.k2.cz, and pressing the Scan Me button, the application tests the security settings of the web pages.

Picture: Testing the security of web pages
After the application test is performed, the HTTP Observatory tab displays the test result and the score achieved in the test. The aim is to achieve the highest possible score. We recommend configuring the server so that the resulting score is at least at level B.
The individual security aspects of the web pages are scored, positively, or negatively if the setting is incorrect. Serious errors are scored with a higher number of negative points. A detailed description of the error can be obtained for the individual test items by clicking through. Most of the correct security settings of web pages come down to the correct settings of the web server. It is a good idea to run a new test after each change.
Correct CSP (Content Security Policy) settings depend on specifying the safe sources of loaded scripts in the server configuration. When setting restrictions, or allowing safe sources of loaded scripts, it is advisable to test the functionality of the web pages. In the e-shop settings, additional sources can be inserted, which must also be added to the allowed sources.
Checking the correctness of e-shop settings
The correct e-shop settings can be verified using the check page web-checker.k2.cz. On the page, you only need to enter the address to be verified and start the check with the Verify button.
There are three states within the settings check:
|
Nastaveno/funguje |
|
Nenastaveno/nefunguje |
|
Not relevant for the given settings |

Picture: Result of the e-shop settings check
Possible errors and warnings in the settings and use of e-shop functions:
http => https |
checks the redirection of http to https |
http non-www => https www |
checks the redirection of an address without www and without ssl to www with ssl for a website on a subdomain, e.g. tv.k2.cz, this test is not performed |
https non-www => https www |
checks the redirection of an address without www with ssl to www with ssl for a website on a subdomain, e.g. tv.k2.cz, this test is not performed |
Data cache
file cache enabled |
is its use turned on in cfg? It does not have to be if the memory cache is turned on. |
memory cache enabled |
is its use turned on in cfg? |
memory cache online |
does it work? |
smartsearch enabled |
is its use turned on in cfg? |
smartsearch online |
does it work? |
Picture cache
file cache enabled |
is it turned on in cfg? Pictures are stored on the web server. |
local file cache |
suitable only for a file cache located locally on the web server |
picture server enabled |
is the use of the picture server turned on in cfg? Note: If it is turned on, the "local file cache" record will have the state |
SEO
robots allowed |
indexing allowed |
robots.txt exists |
check of the existence of the robots.txt file |
sitemap.xml exists |
check of the existence of the sitemap.xml file |
simple urls allowed |
cfg from k2 |
Analytics
GAE enabled |
is it turned on? |
GTM enabled |
is it turned on? |
data layer name |
only if GTM is turned on |
valid data layer |
only if GTM is turned on |