Main Contents

Convert IIS SSL Cert to Apache

November 27, 2009

Export your SSL Cert to a PFX file and include the private key. Copy it to your apache server.

# openssl pkcs12 -in www.yourdomain.com.pfx -nocerts -out www.yourdomain.key.pem
# openssl pkcs12 -in www.yourdomain.com.pfx -clcerts -nokeys -out www.yourdomain.cert.pem
# openssl rsa -in www.yourdomain.key.pem -out www.yourdomain.key

Copy contents of www.yourdomain.cert.pem between and including BEGIN CERTIFICATE and END CERTIFICATE into www.yourdomain.cert.

Here’s a sample apache virtualhost config file that includes redirecting the non-SSL site to the new SSL site:

<VirtualHost *:80>
 ServerName www.yourdomain.com
 Redirect permanent / https://www.yourdomain.com/
</VirtualHost>

<VirtualHost *:443>
 ServerName www.yourdomain.com
 DocumentRoot /var/www/html
 <Directory /var/www/html>
  AllowOverride All
 </Directory>
 SSLEngine on
 SSLCertificateFile /path/to/www.yourdomain.cert
 SSLCertificateKeyFile /path/to/www.yourdomain.key
</VirtualHost>

Filed under: Linux, Microsoft, Uncategorized, Windows | Comments (0)

Find SQL queries that use too much CPU

November 11, 2009

SELECT total_worker_time/execution_count AS AvgCPU
, total_worker_time AS TotalCPU
, total_elapsed_time/execution_count AS AvgDuration
, total_elapsed_time AS TotalDuration
, (total_logical_reads+total_physical_reads)/execution_count AS AvgReads
, (total_logical_reads+total_physical_reads) AS TotalReads
, execution_count
, SUBSTRING(st.TEXT, (qs.statement_start_offset/2)+1
, ((CASE qs.statement_end_offset  WHEN -1 THEN datalength(st.TEXT)
ELSE qs.statement_end_offset
END - qs.statement_start_offset)/2) + 1) AS txt
, query_plan
FROM sys.dm_exec_query_stats AS qs
cross apply sys.dm_exec_sql_text(qs.sql_handle) AS st
cross apply sys.dm_exec_query_plan (qs.plan_handle) AS qp
ORDER BY 1 DESC

Take note of the AvgCPU value. Fix the query, clear the query cache with:

DBCC FREEPROCCACHE

run the query again a few times, and run the above query again. Compare the numbers.

Filed under: Uncategorized | Comments Off

Mixing 64 and 32 bit applications pools on OWA website

May 23, 2009

If you need to create and run a 32-bit application pool on the same website you are running Exchange OWA, usually the Default Web Site, you need to make a couple changes. For example, you want to run an old ASP component that only runs in 32 bit mode.

  1. Register the DLL - copy it to \Windows\SysWOW64 and run regsvr32 your.dll
  2. Create a 32 bit application pool in IIS 7 - On the advanced settings, set Enable 32-bit applications = True
  3. Create a subfolder and assign your 32-bit app pool to it.
  4. Modify \Windows\system32\inetsrv\config\applicationhost.config:
    <location path="Default Web Site">
            <system.webServer>
                isapiFilters>
                    <clear />
                    <filter name="Exchange OWA Cookie Authentication ISAPI Filter" path="D:\Program Files\Microsoft\Exchange Server\ClientAccess\owa\auth\owaauth.dll" enabled="true" preCondition="bitness64" />
                    <filter name="Exchange ActiveSync ISAPI Filter" path="D:\Program Files\Microsoft\Exchange Server\ClientAccess\sync\bin\AirFilter.dll" enabled="true" preCondition="bitness64" />
                </isapiFilters>

    Notice the added preCondition=”bitness64″. This tells those filters to only run on 64 bit app pools.

Filed under: Microsoft, Windows | Comments (2)