Note: This article has been deprecated as of 2024/01/10. It is no longer maintained and may contain outdated information. For updated content, please refer to How to install a local eFront portal using Docker.
Reason for Deprecation: custom, local installations are no longer supported. If you have any questions or need further assistance, please contact our support. |
In this short guide, we will describe the process of setting up eFront on a Windows 2012 R2 server, using IIS 8.5. For the sake of the guide, we will start off with a brand new Windows 2012 R2 Datacenter installation on the Azure Cloud.
Note: If you will be using Internet Explorer, then the first thing to do is to turn off IE’s Enhanced Security Configuration, from the server manager → local server.
|
Table of contents
- Step A: Add IIS Role and Features.
- Step B: Install PHP.
- Step C: Configure the IIS and set file permissions.
- Step D: Download and install the database server.
- Step E: Initial configuration of efront.
- Step F: Installing WinCache on IIS.
- Step G: Installing MemCache on IIS.
- Step H: Enabling OpCache on IIS.
- Step I: Edit web.config file for increasing limits.
- Step J: Installing an SSL certificate on IIS from Let's encrypt.
Step A: Add IIS Role and Features.
- Launch the Server Manager and click on “Add Roles and Features” to start the wizard.
- Click on next, accepting defaults, until you reach the “Select server roles” page.
-
Select “Web server (IIS)” from the list of check-boxes. A popup will prompt you to add additional features. Click on “Add Features” and then “Next”.
- Click on Next accepting defaults for the rest of the pages, until you reach the “Confirm installation selections” page. Click on “Install” and wait for the installation to complete, then click “Close”.
Step B: Install PHP.
- From the “Tools” section in server manager, launch the IIS Manager.
- Click the downward arrow next to the server name to expand. You will be prompted to get started with the Microsoft Web Platform (WebPl). Click “Yes” and a new web page will appear.
Alternatively, you can launch this at any time by clicking “Get new Web Platform Components”. - Click “Free Download” and run the file.
- The platform installer will launch and show a list of items. Use the search bar at the top-right corner to search for “PHP 7.4” and click to add PHP 7.4 and Windows Cache Extension 2.0 for PHP 7.4. Click "Install" and accept the terms.
- After the installation is complete, a results page will appear — feel free to ignore the “PHP Manager was not installed message.” Click “Finish” and Exit the WebPI.
- Relaunch the IIS Manager. This is important so that newly installed options might appear (such as the URL Rewrite).
Step C: Configure the IIS and set file permissions.
- Expand the server name in the left pane and right-click on the Default website. Select “Remove”.
- Download and extract eFront inside the folder c:\inetpub\efront. We need to give proper write permissions, so right click on the eFront folder and click on Properties and then on the “Security” tab.
- Click on “Edit” then “Add” and type “IUSR” in the field “Enter the object names to select”. Click on “Check names” to verify that this user actually exists. Then click on “OK”.
-
Click on the “Modify” option in the “Allow” column and click on “Apply”. The system will apply the selected permissions across all eFront files and folders.
Note: These are generic permissions that are suitable for a development/staging environment. For production environments, write access should be granted only on the folders described in the how to prepare and install your eFront guide step 3 here. - On the IIS Manager, right-click on the Sites entry and select “Add Website”.
- On the website’s properties, enter “efront” for the name and “C:\inetpub\efront\www” as the physical path and click on "OK".
- Back to the IIS properties, select the “eFront” site and double click on “URL Rewrite”.
- On the right pane, there is an option to “Import rules”. Click on it to bring up the “Import mod_rewrite rules” option.
- Under the “Configuration file”, click on the dots to navigate to the file: C:\inetpub\efront\www\.htaccess and then click on Import. The “Rewrite rules” and “Converted Rules” areas will be filled.
-
On the “Converted rules” area, scroll to the bottom. You’ll notice that one rule generates an error - it’s because it’s not compatible with IIS, so we can safely remove it from the “Rewrite rules” page. Remove also subdomains part because it may cause installation issues.
# Subdomain-specific rules:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{HTTP_HOST} ^(?!www\.)([^.]+)\. [NC]
RewriteRule !^subdomains/ subdomains/%1/www%{REQUEST_URI} [QSA,L]
To continue, please make sure that under 'Rewrite rules:' window you have the following:
RewriteEngine On
# Normal setup:
RewriteCond %{REQUEST_URI} !=/server-status
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]
Note: If you want to enable the rest API feature you must also import the .htaccess file that is located in the /www/API directory. From the IIS Manager you must specifically select the API folder on the left and then add the rewrite rules.
We remove the following lines from the .htaccess for it to work properly.
RewriteRule ^ Index.php [QSA,L]
# HTTP Basic Auth (f-cgi workaround):
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
The final .htaccess should look like this:RewriteEngine On
# API:
RewriteCond %{REQUEST_URI} !(v[1-9]mobile)
RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_URI} (v[1-9]mobile)
RewriteRule ^ ../index.php [QSA,L]
- As soon as the Rewrite rules are correct, you will notice that the “Apply” option, on the top-right, is enabled. Click on it to apply the rules and proceed.
Step D: Download and install the database server.
- You can install the database server from the MySQL website and download the Mysql 5.7 installer package. Make sure you download the large installer as it includes all features shown in this tutorial’s images.
- Click “No thanks, just start my download” if you don’t want to signup or login, and run the downloaded package.
- Once the installation begins, accept the license agreement and choose to perform a “Custom” installation.
- Expand the MySQL Servers option until you see the MySQL Server X64 option. Click the arrow to move it to the “Products to be installed” list.
-
Install the prerequisite Microsoft Visual C++ 2013 Redistributable Package, if it isn’t already installed.
- Click “Execute.”
- Once the installation is complete, click “Next.” In the configuration options, select “Server Machine” as the Config Type.
- Enter a root password.
- Accept defaults in the following pages and click "Execute".
- As the installation is now complete, click “Finish” to close the installer. You can verify that everything is working properly by locating the “MySQL Command-line tool” in the Installed programs.
-
This will start the command-line interface for MySQL, which you can access by using your root password.
Note: If you download and install MySQL 8, you should know that it uses, by default, “auth_soket” as the authentication system and not a password. In this case, you will need to change the authentication settings:
- Open Command Prompt (CMD) and access MySQL root `mysql -u root -pabc123`
- Run query: ` ALTER USER 'root'@'localhost' IDENTIFIED WITH mysl_native_password BY 'password';`, where 'password' is the password set in step 29.
Step E: Initial configuration of efront.
- Open your browser and visit http://localhost. You should see eFront installation starting page.
- Click on Next and fill in the required information.
- Installation is successful! You are now signed in as administrator. You should fill in your license key.
- You can now start using the system. Click on the “Maintenance” section and then on “Information” to verify that all required and recommended components are in place (such as caching).
- In order IIS to work as expected with non English characters (umlaut etc) you have to run the following from command line (and restart IIS afterward):
reg add HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\w3svc\Parameters /v FastCGIUtf8ServerVariables /t REG_MULTI_SZ /d REQUEST_URI\0PATH_INFO
Step F: Installing WinCache on IIS.
Note: As of PHP 8.0.0 WinCache is no longer supported. If you are using PHP 8.0.0 proceed to step G. |
To drastically improve the performance of any high-traffic PHP website running under IIS you can consider installing one of the free caching PHP extension tools available, WinCache, which is included in all the base PHP installation packages for Windows since version 5.2. Installing WinCache is fairly easy.
- Check whether the php_wincache.dll file is included in your PHP installation. If you followed this guide it should already be installed in step B.4 and is located in the /ext/ subfolder of your PHP installation folder. If it’s not there, you can download it manually from the WinCache official website (just be sure to pick the file matching your PHP version 7.4), unpack it and copy the .dll file to the aforementioned folder.
-
Enable the WinCache extension in your PHP installation by adding the following two lines to your php.ini file, which is usually located in your PHP installation folder OR in the Windows root folder:
reg[PHP_WINCACHE]
extension=php_wincache.dll
Note: Before you proceed check if the extension is already enabled by doing a quick text search for “php_wincache.dll” inside the file. If you don’t know where your php.ini file is, you can track it by executing the phpinfo() command on your server. -
Run the phpinfo() command to check if the WinCache extension has been properly installed or not. If that’s the case you will be able to see something like that by searching for the Wincache section.
-
To activate the WinCache extension add the following configuration settings in your php.ini file:
[WinCache]
; Full reference: http://php.net/manual/en/wincache.configuration.php
wincache.fcenabled = 1
wincache.ocenabled = 1
wincache.ucenabled = 0
wincache.fcachesize = 64
wincache.fcndetect = 1
wincache.maxfilesize = 256
wincache.chkinterval = 10
wincache.enablecli = 1
wincache.ucachesize = 8
wincache.scachesize = 8
Note: These are generic settings for most production environments. You can fine-tune them by taking a look at the WinCache reference guide, where you will find a detailed description of all WinCache functions in order to adapt them to your needs.
- When you are done, save the php.ini file and restart your IIS. Check and confirm that the WinCache extension is enabled and working by executing the phpinfo() command again:
-
After completing setting up WinCache, you may access the WinCache panel from your eFront system, when logged in as administrator, visit Maintenance > Information > Cache.
Step G: Installing MemCached on IIS.
- Download Memcached installer zip from the following links based on your Windows setup – Win32, Win64.
- Extract the contents of the archive in folder C:\memcached
- Check and make sure that there is a memcached.exe file in the extracted folder.
- Open Command Prompt as admin and execute the commands below to install it as service and start it.
C:\memcached\memcached-1.2.6-win32-bin>memcached.exe -d install
C:\memcached\memcached-1.2.6-win32-bin>memcached.exe -d start - In your eFront environment, go to Home > System settings > Integrations > Caching, add the following lines, and save:
Caching method: Memcached
Caching prefix: efrontpro
Memcache host: localhost
Memcache port: 11211 -
Download the php_memcached.dll for PHP (Win32, Win64) and then place it in your php_directory/ext folder. Find and edit your php.ini file and add the following line:
extension=memcached
- Restart the webserver and you will find “Memcached” in Home > Maintenance > Information > PHP Info.
Step H: Enabling OpCache on IIS.
It is highly recommended to enable OpCache. This extension is included with PHP for Windows. It compiles and optimizes PHP scripts and caches them in memory so that they are not compiled every time a page is loaded. To do so, set the php.ini to:
opcache.enable=On
opcache.enable_cli=On
Restart the web server. For more info, see: OpCache Configuration
Step I: Edit web.config file for increasing limits.
In case you face any issues that seems to be related with time or request limits although corresponding options for php are already set, you may have to set them for IIS too. Follow steps below:
- Open <wwwrootDir>/<Web Service>/web.config
- Add line for maxRequestLength and executionTimeout
<configuration> <system.web> <httpRuntime maxRequestLength="524288" executionTimeout="600" /> </system.web> </configuration>
For IIS7 and above, you also need to add the lines below:
<system.webServer> <security> <requestFiltering> <requestLimits maxAllowedContentLength="524288000" /> </requestFiltering> </security> </system.webServer>
-
Restart IIS
Note 1: Regular API and mobile API might have issues working with the default configurations. You might need to re-arrange the orders to change the IIS rules. The attached web.config (at the end of this article) has the appropriate rules and rules order.
Note 2:To facilitate file uploads, make sure to update the following values in the IIS too
|
Step J: Installing an SSL certificate on IIS from Let's encrypt.
Let's encrypt is a service that offers free SSL certificates. Below we describe the process of installing a certificate from Let's encrypt using a command line utility.
This utility tool runs from the command line and has a few very easy to understand options. What you can do is pick a site from the list of active Web sites using host headers on your server and the utility goes out and creates a certificate for you, creates an https binding and attaches the certificate. If there's already a certificate then the certificate is replaced with the new one.
You can install the latest version from their GitHub Releases page and simply unzip the zip file into a folder.
- To run it, simply run the executable letsencrypt.exe.
- Once you run letsencrypt.exe you will be presented with the following screen:
- Press 'N' to create or update your SSL certificate
- In the next screen, in the prompt "Which kind of certificate would you like to create?", input the number '4' (Manually input host names).
- Once you have selected the above, enter your app host name (localhost, actual-domain.com etc) (do not prepend the hostname/s with http or https). If everything is correct, the LetsEncrypt script will detect your app/site installation referred by the hostnames you entered .
- Enter the number of the site/app you wish to generate the SSL certificate for.
- The SSL certificate has now been installed.
- To verify the certificate has been installed, open your IIS manager and head over to "Server Certificates".
- You should see your certificate listed:
Note: if you encounter difficulties uploading files after performing the above configuration, please check and change the upload_tmp_dir entry in your php.ini file. |