Using MAMP 3.4, how do I upgrade to Apache 2.4 and OpenSSL 1.0.2 to meet the ATS iOS 9 requirements?
For Mac OS X Yosemite


Update openssl by brew to version >= 1.0.2d
TLS 1.2 works only with apache 2.4 and actually MAMP is still given with apache 2.2. SOLUTION: download and install the latest version of AMPPS which runs a version of apache 2.4.x
create a self signed certificate with sha256 (as requested by iOS 9) with

openssl req -x509 -nodes -sha256 -days 365 -newkey rsa:2048 -keyout server.key -out server.crt


&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;and save server.key and server.crt into /Applications/AMPPS/apache/conf


Be sure that ssl modules are loaded inside httpd.conf file of AMPPS
Edit file /Applications/AMPPS/apache/conf/extra/httpd-ssl.conf adding:




&lt;VirtualHost localhost:443&gt;
   DocumentRoot "/Applications/AMPPS/www"
   ServerName localhost
   SSLEngine on
   SSLProtocol all -SSLv2 -SSLv3
   SSLHonorCipherOrder on
   SSLCertificateFile "/Applications/AMPPS/apache/conf/server.crt"
   SSLCertificateKeyFile "/Applications/AMPPS/apache/conf/server.key"
&lt;/VirtualHost&gt;


inside 

&lt;IfModule ssl_module&gt; ... &lt;/IfModule&gt; 



iOS 9 simulator will annoy you each time you use NSURLSession raising an error 9813 saying that the certificate is not valid (because is self signed). So in each class where you are going to use NSURLSession do, for example, the following:




class LoginService: NSObject, NSURLSessionDelegate {

func URLSession(session: NSURLSession,
    task: NSURLSessionTask,
    didReceiveChallenge challenge: NSURLAuthenticationChallenge,
    completionHandler: (NSURLSessionAuthChallengeDisposition, NSURLCredential?)
    -&gt; Void) {

    completionHandler(NSURLSessionAuthChallengeDisposition.UseCredential, NSURLCredential(forTrust: challenge.protectionSpace.serverTrust!))
}

...

func requestLoginWithURL (requestURL: NSURL, completionHandler: (success: Bool?) -&gt; Void) {
    let configuration =
    NSURLSessionConfiguration.defaultSessionConfiguration()

    let urlRequest: NSURLRequest = NSURLRequest(URL: requestURL)

    let session = NSURLSession(configuration: configuration, delegate: self, delegateQueue:NSOperationQueue.mainQueue())

    /*
    dataTaskWithRequest: creates an HTTP request for the specified URL request object, and calls a handler upon completion.
    */
    let task = session.dataTaskWithRequest(urlRequest, completionHandler: { (data: NSData?, response: NSURLResponse?, error: NSError?) -&gt; Void in

...
}


where the function URLSession is a delegate which will prevent the app from crashing because of the self signed certificate and it will accept anyway.