Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.x iis - The strict minimum for Magento to Work on IIS #2

Open
wants to merge 17 commits into
base: 1.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 22 additions & 0 deletions app/NonComposerComponentRegistration.php
@@ -0,0 +1,22 @@
<?php
/**
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

$pathList[] = __DIR__ . '/code/*/*/cli_commands.php';
$pathList[] = __DIR__ . '/code/*/*/registration.php';
$pathList[] = __DIR__ . '/design/*/*/*/registration.php';
$pathList[] = __DIR__ . '/i18n/*/*/registration.php';
$pathList[] = dirname(__DIR__) . '/lib/internal/*/*/registration.php';
$pathList[] = dirname(__DIR__) . '/lib/internal/*/*/*/registration.php';
foreach ($pathList as $path) {
// Sorting is disabled intentionally for performance improvement
$files = glob($path, GLOB_NOSORT);
if ($files === false) {
throw new \RuntimeException('glob() returned error while searching in \'' . $path . '\'');
}
foreach ($files as $file) {
include $file;
}
}
137 changes: 137 additions & 0 deletions chef/chef.yml
@@ -0,0 +1,137 @@
id: 'magentocommerce'
deployers:
# App is the artifact itself, other deployers
# depend on this one!
app:
type: 'app'
iis:
type: 'iis'
pools:
default:
Enable32BitAppOnWin64: true
AutoStart: true
ManagedPipelineMode: Integrated
StartMode: AlwaysRunning
ManagedRuntimeVersion: ''
mounts:
root:
root: true
path: '/'
bindings:
local:
# Binding will be mounted through HOSTS file
# automatically when using interface = 'local'
hostname: 'local.magentocommerce.com'
port: 80
interface: 'local'
php:
type: 'php'
runtime:
- {type: 'dl', uri: 'http://windows.php.net/downloads/releases/archives/php-7.0.23-nts-Win32-VC14-x64.zip', maps: {'*' : 'php/'}}
- {type: 'dl', uri: 'http://windows.php.net/downloads/pecl/releases/xdebug/2.5.5/php_xdebug-2.5.5-7.0-nts-vc14-x64.zip', maps: {'php_xdebug.dll':'php/ext/php_xdebug.dll'}}
- {type: 'dl', uri: 'https://ci.appveyor.com/api/buildjobs/7b47bfc24eynberd/artifacts/x64%2FRelease%2Fphp_tideways.dll' , maps: {'x64%2FRelease%2Fphp_tideways.dll':'php/ext/php_tideways.dll'}}
- {type: 'dl', uri: 'http://windows.php.net/downloads/pecl/releases/igbinary/2.0.1/php_igbinary-2.0.1-7.0-nts-vc14-x64.zip', maps: {'php_igbinary.dll': 'php/ext/php_igbinary.dll'}}
- {type: 'dl', uri: 'http://windows.php.net/downloads/pecl/releases/wincache/2.0.0.8/php_wincache-2.0.0.8-7.0-nts-vc14-x64.zip', maps: {'php_wincache.dll': 'php/ext/php_wincache.dll'}}
# CERTIFICATES
- {type: 'dl', uri: 'http://curl.haxx.se/ca/cacert.pem', maps: {'cacert.pem': '/cacert.pem'}}
- {type: 'file', 'action':'copy', 'source':'php/php.ini-production', 'destination':'php/php.ini'}
- {type: 'ini', 'key':curl.cainfo, 'value':'%RUNTIME%/cacert.pem'}
- {type: 'ini', 'key':openssl.cafile, 'value':'%RUNTIME%/cacert.pem'}
# EXTENSION DIR
- {type: 'ini', 'key':extension_dir, 'value':'%RUNTIME%/php/ext'}
# EXTENSION SETTINGS
- {type: 'ini', multivalue: true, 'key':extension, 'value':php_intl.dll}
- {type: 'ini', multivalue: true, 'key':extension, 'value':php_bz2.dll}
- {type: 'ini', multivalue: true, 'key':extension, 'value':php_curl.dll}
- {type: 'ini', multivalue: true, 'key':extension, 'value':php_enchant.dll}
- {type: 'ini', multivalue: true, 'key':extension, 'value':php_exif.dll}
- {type: 'ini', multivalue: true, 'key':extension, 'value':php_fileinfo.dll}
- {type: 'ini', multivalue: true, 'key':extension, 'value':php_gettext.dll}
- {type: 'ini', multivalue: true, 'key':extension, 'value':php_gd2.dll}
- {type: 'ini', multivalue: true, 'key':extension, 'value':php_mbstring.dll}
- {type: 'ini', multivalue: true, 'key':extension, 'value':php_openssl.dll}
- {type: 'ini', multivalue: true, 'key':extension, 'value':php_soap.dll}
- {type: 'ini', multivalue: true, 'key':extension, 'value':php_xmlrpc.dll}
- {type: 'ini', multivalue: true, 'key':extension, 'value':php_wincache.dll}
- {type: 'ini', multivalue: true, 'key':extension, 'value':php_pdo_mysql.dll}
- {type: 'ini', multivalue: true, 'key':extension, 'value':php_xsl.dll}
- {type: 'ini', multivalue: true, 'key':extension, 'value':php_igbinary.dll}
- {type: 'ini', multivalue: true, 'key':extension, 'value':php_tideways.dll}
- {type: 'ini', multivalue: true, 'key':extension, 'value':php_com_dotnet.dll}
- {type: 'ini', multivalue: true, 'key':zend_extension, 'value':php_opcache.dll}
# MYSQL
- {type: 'ini', 'key':pdo_mysql.cache_size, 'value':2000}
- {type: 'ini', 'key':mysql.allow_persistent, 'value':On}
# RUNTIME DIRECTORIES
- {type: 'ini', 'key':error_log, 'value':'%LOG%/php_error_%DEPLOYMENTID%.log', ensureDir: 'file'}
- {type: 'ini', 'key':upload_tmp_dir, 'value':'%TEMP%/upload_temp_dir', ensureDir: 'dir'}
- {type: 'ini', 'key':session.save_path, 'value':'%TEMP%/session_save_path/', ensureDir: 'file'}
- {type: 'ini', 'key':date.timezone, 'value':'Europe/Madrid'}
# WINCACHE...
- {type: 'ini', 'key':wincache.fcenabled, 'value': 0}
- {type: 'ini', 'key':wincache.ucenabled, 'value': 1}
- {type: 'ini', 'key':wincache.fcachesize , 'value': 8}
- {type: 'ini', 'key':wincache.maxfilesize, 'value': 3000}
- {type: 'ini', 'key':wincache.ucachesize , 'value': 128}
- {type: 'ini', 'key':wincache.scachesize , 'value': 16}
- {type: 'ini', 'key':wincache.reroute_enabled , 'value': 0}
- {type: 'ini', 'key':wincache.filemapdir , 'value':'%RUNTIME%/wincache_filemap', ensureDir: 'dir'}
- {type: 'ini', 'key':wincache.enablecli , 'value':'On'}
# TIDEWAYS
- {type: 'ini','key':tideways.api_key , 'value': 'xxx'}
- {type: 'ini','key':tideways.auto_prepend_library , 'value': 0}
- {type: 'ini','key':tideways.connection , 'value': 'tcp://127.0.0.1:8136'}
- {type: 'ini','key':tideways.sample_rate , 'value': 10}
- {type: 'ini','key':tideways.auto_start , 'value': 1}
# GENERIC
- {type: 'ini','key':fastcgi.impersonate , 'value': 1}
- {type: 'ini','key':cgi.fix_pathinfo , 'value': 1}
- {type: 'ini','key':cgi.force_redirect , 'value': 0}
- {type: 'ini','key':fastcgi.logging , 'value': 0}
- {type: 'ini','key':realpath_cache_size , 'value': '5M'}
- {type: 'ini','key':realpath_cache_ttl , 'value': 1800}
- {type: 'ini','key':max_input_vars , 'value': 6000}
- {type: 'ini','key':memory_limit , 'value': 2048M}
- {type: 'ini','key':max_input_vars , 'value': 6000}
- {type: 'ini','key':max_execution_time , 'value': 600}
- {type: 'ini','key':upload_max_filesize , 'value': 32M}
- {type: 'ini','key':post_max_size , 'value': 32M}
# OPCACHE
- {type: 'ini','key':opcache.enable , 'value': 1}
- {type: 'ini','key':opcache.memory_consumption , 'value': 256}
- {type: 'ini','key':opcache.max_accelerated_files , 'value': 25000}
- {type: 'ini','key':opcache.revalidate_freq , 'value': 2}
- {type: 'ini','key':opcache.interned_strings_buffer , 'value': 16}
- {type: 'ini','key':opcache.validate_timestamps , 'value': 1}
- {type: 'ini','key':opcache.enable_cli , 'value': 1}
- {type: 'ini','key':opcache.file_cache_only , 'value': 0}
- {type: 'ini','key':opcache.file_cache , 'value':'%RUNTIME%/opcache_filecache', ensureDir: 'dir'}
services:
contents:
type: 'disk'
mounts:
var:
path: 'var'
mountpath: 'var'
persist_on_deploy: true
pub_static:
path: 'pub_static'
mountpath: 'pub/static'
persist_on_deploy: true
pub_media:
path: 'pub_media'
mountpath: 'pub/media'
persist_on_deploy: true
app_etc:
path: 'app_etc'
mountpath: 'app/etc'
persist_on_deploy: true
app_config_sandbox:
path: 'app_config_sandbox'
mountpath: 'app/config_sandbox'
persist_on_deploy: true
cron:
type: 'scheduler'
commands: ['php bin\magento cron:run', 'php bin\magento setup:cron:run', 'php update\cron.php']
frequency: 5

22 changes: 22 additions & 0 deletions chef/chef__local.yml
@@ -0,0 +1,22 @@
# Only use this for environment with name "local"
scope-environment-regex: 'local.*'
deployers:
php:
runtime:
- {type: 'ini', multivalue: true, 'key':zend_extension, 'value':php_xdebug.dll}
- {type: 'ini','key':opcache.revalidate_freq , 'value': 1}
- {type: 'ini','key':opcache.validate_timestamps , 'value': 1}
# XDEBUG
- {type: 'ini', 'key':'xdebug.remote_enable', 'value':'on'}
- {type: 'ini', 'key':'xdebug.remote_handler', 'value':'dbgp'}
- {type: 'ini', 'key':'xdebug.remote_host', 'value':'127.0.0.1'}
- {type: 'ini', 'key':'xdebug.remote_connect_back', 'value':'0'}
- {type: 'ini', 'key':'xdebug.remote_port', 'value':'9000'}
- {type: 'ini', 'key':'xdebug.remote_mode', 'value':'req'}
- {type: 'ini', 'key':'xdebug.remote_autostart', 'value':'0'}
- {type: 'ini', 'key':'xdebug.idekey', 'value':'php-vs'}
- {type: 'ini', 'key':'xdebug.profiler_output_dir', 'value':'%LOG%/xdebug_profile', ensureDir: 'dir'}
- {type: 'ini', 'key':'xdebug.trace_output_dir', 'value':'%LOG%/xdebug_trace', ensureDir: 'dir'}
- {type: 'ini', 'key':'xdebug.remote_log', 'value':'%LOG%/remote_%DEPLOYMENTID%.log', ensureDir: 'file'}
- {type: 'ini', 'key':'xdebug.trace_output_name', 'value':'trace.%u'}
- {type: 'ini', 'key':'xdebug.profiler_output_name', 'value':'profile.%u'}
3 changes: 2 additions & 1 deletion composer.json
Expand Up @@ -33,7 +33,8 @@
"": "app/code/"
},
"files": [
"app/etc/NonComposerComponentRegistration.php"
"app/etc/NonComposerComponentRegistration.php",
"app/NonComposerComponentRegistration.php"
]
},
"autoload-dev": {
Expand Down
162 changes: 162 additions & 0 deletions web.config
@@ -0,0 +1,162 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.web>
<httpRuntime maxRequestLength="65535" maxUrlLength="65535" maxQueryStringLength="65535" />
</system.web>
<system.webServer>
<!--Just to make sure these fonts work as expected...-->
<staticContent>
<remove fileExtension=".woff" />
<remove fileExtension=".woff2" />
<mimeMap fileExtension=".woff" mimeType="application/x-font-woff" />
<mimeMap fileExtension=".woff2" mimeType="application/font-woff2" />
</staticContent>
<rewrite>
<rules>
<!-- HTTP_AUTHORIZATION variable removed-->
<rule name="TRACE and TRACK HTTP methods" stopProcessing="true">
<match url=".*" ignoreCase="false" />
<conditions>
<!-- TRACE and TRACK HTTP methods disabled to prevent XSS attacks-->
<add input="{REQUEST_METHOD}" pattern="^TRAC[EK]" ignoreCase="false" />
</conditions>
<action type="Redirect" redirectType="Temporary" url="{R:0}" />
</rule>
<!--rewrite everything else to index.php-->
<rule name="Rewrite everything to index.php" stopProcessing="true">
<match url=".*" ignoreCase="false" />
<conditions>
<add input="{URL}" pattern="^/(media|skin|js)/" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
<!--Symbolic link filetype does not exists in Windows/IIS -->
</conditions>
<action type="Rewrite" url="index.php" />
</rule>
</rules>
</rewrite>
<modules>
<remove name="UrlAuthorization" />
<add name="UrlAuthorization" type="System.Web.Security.UrlAuthorizationModule" />
</modules>
<!--<security>
<authorization>
<remove users="*" roles="" verbs="" />
</authorization>
</security>-->
</system.webServer>
<!--Custom configuration for the pub directory-->
<location path="pub">
<system.webServer>
<rewrite>
<rules>
<clear />
<!-- HTTP_AUTHORIZATION variable removed-->
<rule name="TRACE and TRACK HTTP methods 2" stopProcessing="true">
<match url=".*" ignoreCase="false" />
<conditions>
<!-- TRACE and TRACK HTTP methods disabled to prevent XSS attacks-->
<add input="{REQUEST_METHOD}" pattern="^TRAC[EK]" ignoreCase="false" />
</conditions>
<action type="Redirect" redirectType="Temporary" url="{R:0}" />
</rule>
<rule name="Route requests to index.php 2" stopProcessing="true">
<match url=".*" ignoreCase="false" />
<conditions>
<add input="{URL}" pattern="^/(media|skin|js)/" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="pub/index.php" />
</rule>
</rules>
</rewrite>
</system.webServer>
</location>
<!--Custom configuration for the pub/static directory-->
<location path="pub/static">
<system.webServer>
<rewrite>
<rules>
<clear/>
<rule name="Imported Rule 1-1 - pub" stopProcessing="false">
<match url="^pub/static/version.+?/(.+)$" ignoreCase="false" />
<action type="Rewrite" url="pub/static/{R:1}" />
</rule>
<rule name="Imported Rule 2" stopProcessing="false">
<match url="^pub/static/(.+)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="pub/static.php?resource={R:1}" appendQueryString="false" />
</rule>
</rules>
</rewrite>
</system.webServer>
</location>
<!--Custom configuration for the setup directory-->
<location path="setup">
<system.webServer>
<rewrite>
<rules>
<clear/>
</rules>
</rewrite>
</system.webServer>
</location>
<!--https://stackoverflow.com/questions/37078383/deny-all-files-in-a-directory-via-web-config-setting/37080857#37080857-->
<location path="app">
<system.webServer>
<security>
<authorization>
<remove users="*" roles="" verbs="" />
</authorization>
</security>
</system.webServer>
</location>
<location path="vendor">
<system.webServer>
<security>
<authorization>
<remove users="*" roles="" verbs="" />
</authorization>
</security>
</system.webServer>
</location>
<location path="update">
<system.webServer>
<security>
<authorization>
<remove users="*" roles="" verbs="" />
</authorization>
</security>
</system.webServer>
</location>
<location path="lib">
<system.webServer>
<security>
<authorization>
<remove users="*" roles="" verbs="" />
</authorization>
</security>
</system.webServer>
</location>
<location path="bin">
<system.webServer>
<security>
<authorization>
<remove users="*" roles="" verbs="" />
</authorization>
</security>
</system.webServer>
</location>
<location path="chef">
<system.webServer>
<security>
<authorization>
<remove users="*" roles="" verbs="" />
</authorization>
</security>
</system.webServer>
</location>
</configuration>