Thursday, September 17, 2009

Configuring https in Apache and forwarding to http application

Lines added or modified C:\Program Files\Apache Software Foundation\Apache2.2\conf\httpd.conf.

Listen 8070

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule rewrite_module modules/mod_rewrite.so

LoadModule ssl_module modules/mod_ssl.so

Include conf/extra/httpd-ssl.conf

#RewriteEngine On
#RewriteRule (.*) http://localhost:8080$1
#ProxyPassReverse /kr/ http://localhost:8080/kr/client/knx
#Redirect permanent /kr/ http://localhost:8080/kr/client/knx
#Alias 8070 8080
ProxyPass /kr/ http://localhost:8080/kr/
ProxyPassReverse /kr/ http://localhost:8080/kr/

Lines added or modified C:\Program Files\Apache Software Foundation\Apache2.2\conf\extra\httpd-ssl.conf.

#SSLPassPhraseDialog builtin

SSLCertificateFile "C:/Program Files/Apache Software Foundation/Apache2.2/conf/ssl/server.crt"

SSLCertificateKeyFile "C:/Program Files/Apache Software Foundation/Apache2.2/conf/ssl/server.key"

How do I create a self-signed SSL Certificate for testing purposes?

  1. Make sure OpenSSL is installed and in your PATH.

  2. Run the following command, to create server.key and server.crt files:
    $ openssl req -new -x509 -nodes -out server.crt -keyout server.key
    These can be used as follows in your httpd.conf file:
                 SSLCertificateFile    /path/to/this/server.crt
    SSLCertificateKeyFile /path/to/this/server.key
  3. It is important that you are aware that this server.key does not have any passphrase. To add a passphrase to the key, you should run the following command, and enter & verify the passphrase as requested.

    $ openssl rsa -des3 -in server.key -out server.key.new
    $ mv server.key.new server.key

    Please backup the server.key file, and the passphrase you entered, in a secure location.
Refer http://httpd.apache.org/docs/2.0/ssl/ssl_faq.html for more details on openssl.


No comments:

Post a Comment

Followers