Tag: Windows Azure

Windows Azure and symfony 1.4 important php.ini settings

When you try to get symfony running (for instance with windowsazure4e) there will occur some problems with the deployed version.

I could solve the problems with these very important php.ini settings:

  • Locate the “cgi.force_redirect” setting and remove the comment and set the value to “0“‘ (Note: 0 for IIS and 1 for Apache or iPlanet).
  • Locate the “cgi.fix_pathinfo” setting and remove the comment. Leave the value as “1” (Note: cgi.fix_pathinfo provides full PATH_INFO/PATH_TRANSLATED support for CGI. Previously the behavior of PHP was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to ignore PATH_INFO. For more information on PATH_INFO, see the cgi specs. Setting this to 1 will cause PHP CGI to fix its paths to conform to the spec.).
  • Locate the “fastcgi.impersonate” setting and remove the comment, leave the value as “1” (Note: FastCGI under IIS supports the ability to impersonate security tokens of the calling client. This allows IIS to define the security context that the request runs under.).
  • Locate “extension_dir” and set it to “ext“.

WindowsAzure: Enable SQL Azure

To enable SQL Azure for your web role you simply need to enhance the following settings in your configuration files:

ServiceDefinition.csdef

    <ConfigurationSettings>
      <Setting name="SqlAzureHost"/>
      <Setting name="SqlAzureUserName"/>
      <Setting name="SqlAzurePassword"/>
      <Setting name="SqlAzureDatabase"/>
      ...
    </ConfigurationSettings>

ServiceConfiguration.cscgf

    <ConfigurationSettings>
      <Setting name="SqlAzureHost" value="HOST_NAME.database.windows.net"/>
      <Setting name="SqlAzureUserName" value="USERNAME@HOST_NAME"/>
      <Setting name="SqlAzurePassword" value="PASSWORD"/>
      <Setting name="SqlAzureDatabase" value="DATABASE"/>
       ...
    </ConfigurationSettings>

The trick here is to add the server name behind the username.


windowsAzure: Web.config settings

To optimize the performance of my WindowsAzure web role I analysed it with the firefox plugin page speed. To pass the several tests I needed to enhance the following settings.

Leverage browser caching:

<system.webServer>
    <staticContent>
      <clientCache httpExpires="Sun, 29 Mar 2020 00:00:00 GMT" cacheControlMode="UseExpires" />
    </staticContent>

I changed the above setting to:

<system.webServer>
    <staticContent>
      <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="1.00:00:00"  />
    </staticContent>

Because it is strongly not recommend to use high expiration dates, because you can not influence client or proxy cache if the file is already cached. In this example it set it to 1 day.

More Information here.

Specify a Vary: Accept-Encoding header:
<system.webServer>
	  <httpProtocol>
	    <customHeaders>
		    <remove name="Vary"></remove>
		    <add name="Vary" value="Accept-Encoding"></add>
	    </customHeaders>
	  </httpProtocol>

Also I changed here a little bit:

<system.webServer>
	  <httpProtocol>
	    <customHeaders>
		    <remove name="Vary"></remove>
		    <add name="Vary" value="Accept-Encoding, Cookie"></add>
	    </customHeaders>
	  </httpProtocol>

Cookie means in this case to use a different cache version for each session.

EDIT: I removed the “Cookie”-Setting again, because it slows down every page request up to 2  Seconds!

More information here.

Enable compression:

<system.webServer>
    <staticContent>
      <remove fileExtension=".js" />
      <mimeMap fileExtension=".js" mimeType="text/javascript" />
    </staticContent>

    <httpCompression
        directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files"
        cacheControlHeader="max-age=86400"
			  noCompressionForHttp10="false"
			  noCompressionForProxies="false"
			  sendCacheHeaders="true"
                          minFileSizeForComp="0">
      <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" />
      <dynamicTypes>
        <add mimeType="text/*" enabled="true" />
        <add mimeType="message/*" enabled="true" />
        <add mimeType="application/x-javascript" enabled="true" />
        <add mimeType="*/*" enabled="false" />
      </dynamicTypes>
      <staticTypes>
        <add mimeType="text/*" enabled="true" />
        <add mimeType="message/*" enabled="true" />
        <add mimeType="application/javascript" enabled="true" />
        <add mimeType="*/*" enabled="false" />
      </staticTypes>
    </httpCompression>
    <urlCompression doStaticCompression="true" doDynamicCompression="true" />

Not that httpCompression is already enabled by default, but the default setting for minFileSizeForComp ist 2700kB, so small files will be ignored. Furthermore I disabled the compression for HTTP1.0 and Proxies, because older browser sometime have problems with it.

The modification of the mimeMap is done because of the different mimeTypes for JavaScript, so we give all .js files the same mime type which will be compressed.


WindowsAzure: Remote Desktop

I needed some research to find out how to configure a WindowsAzure web role manually to activate Remote Desktop.

Here are the settings:

ServiceDefinition.csdef:

 <WebRole>
   ...
   <Imports>
     <Import moduleName="RemoteAccess" />
     <Import moduleName="RemoteForwarder" />
   </Imports>
 </WebRole>

Each role of the deployments which needs RDP requires the module “RemoteAccess”. Only one role needs to import the module “RemoteForwarder”.

ServiceConfiguration.cscfg

 <Role name="WorkerRole">
   <Instances count="2" />
   <ConfigurationSettings>
     ...
     <Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.Enabled" value="true" />
     <Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountUsername" value="jimoneil" />
     <Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountEncryptedPassword" value="ENC_PASSWORD" />
     <Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountExpiration" value="2011-01-27T23:59:59.0000000-05:00" />
    <Setting name="Microsoft.WindowsAzure.Plugins.RemoteForwarder.Enabled" value="true" />
   </ConfigurationSettings>
   <Certificates>
     <Certificate name="Microsoft.WindowsAzure.Plugins.RemoteAccess.PasswordEncryption"
                  thumbprint="CERTIFIKATE_THUMBPRINT"
                  thumbprintAlgorithm="sha1" />
   </Certificates>
 </Role>

“RemoteForwarder” only needs to be activiated for the forwarder role. Follow the link below for a generate password how-to. The thumbprint can be found in the management portal.

Links


Copyright © 2007-2012 iTopia. All rights reserved.
Jarrah theme by Templates Next | Powered by WordPress