Apache SSL
How to configure proxy with apache
1. download apache httpd-2.2.25-win32-x86-openssl-0.9.8y.msi form http://www.eng.lsu.edu/mirrors/apache//httpd/binaries/win32/
2. install apache
3. create new config file httpd-custom.conf (simply copy any httpd file and clear content rename to httpd-custom and copy to [apache 2.2 path]/conf/extra directory)
4. add following lines to httpd-custom.conf
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
<VirtualHost *:80>
ProxyPass /lasharma ajp://10.97.98.184:9109/lasharma
1. download apache httpd-2.2.25-win32-x86-openssl-0.9.8y.msi form http://www.eng.lsu.edu/mirrors/apache//httpd/binaries/win32/
2. install apache
3. create new config file httpd-custom.conf (simply copy any httpd file and clear content rename to httpd-custom and copy to [apache 2.2 path]/conf/extra directory)
4. add following lines to httpd-custom.conf
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
<VirtualHost *:80>
ProxyPass /lasharma ajp://10.97.98.184:9109/lasharma
ProxyPassReverse /lasharma ajp://10.97.98.184:9109/lasharma
ServerName www.lasharma.com
</VirtualHost>
5. include httpd-custom.conf file to httpd.conf (as httpd.conf is default file)
for including file just add below line to httpd.conf
Include conf/extra/httpd-lasharmacustom.conf
Troubleshoot
1. add ServerName to etc/hosts of client machine (machine from where accessing lasharma i.e browser machine).
E.g. access lsharma from machine named xyz.com having IP 11.96.121.108 then add entry to /etc/host of xyz like 11.96.121.108 <ServerName> (mentioned in httpd-custom.conf virtual host)
How to configure proxy with apache in SSL
1. Open the Command Prompt and browse to [apache 2.2 path]/bin.
2. Enter openssl req -config ../conf/openssl.cnf -new -out lasharma-custom.csr -keyout lasharma-custom.pem
3. Enter openssl rsa -in lasharma-custom.pem -out lasharma-custom.key
4. Enter openssl x509 -in lasharma-custom.csr -out lasharma-custom.crt -req -signkey lasharma-custom.key -days 3650
5. Four file will be created at [apache 2.2 path]/bin name lasharma-custom.crt, lasharma-lasharma.csr, lasharma-custom.key, lasharma-custom.pem
6. open [apache 2.2 path]/config/extra/httpd-ssl.conf file and add following information
uncomment Listen 443
update certificate path SSLCertificateFile "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/bin/lasharma-custom.crt"
update key path SSLCertificateKeyFile "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/bin/lasharma-custom.key"
add ProxyPass /lasharma ajp://10.97.98.184:9109/lasharma
</VirtualHost>
5. include httpd-custom.conf file to httpd.conf (as httpd.conf is default file)
for including file just add below line to httpd.conf
Include conf/extra/httpd-lasharmacustom.conf
Troubleshoot
1. add ServerName to etc/hosts of client machine (machine from where accessing lasharma i.e browser machine).
E.g. access lsharma from machine named xyz.com having IP 11.96.121.108 then add entry to /etc/host of xyz like 11.96.121.108 <ServerName> (mentioned in httpd-custom.conf virtual host)
How to configure proxy with apache in SSL
1. Open the Command Prompt and browse to [apache 2.2 path]/bin.
2. Enter openssl req -config ../conf/openssl.cnf -new -out lasharma-custom.csr -keyout lasharma-custom.pem
3. Enter openssl rsa -in lasharma-custom.pem -out lasharma-custom.key
4. Enter openssl x509 -in lasharma-custom.csr -out lasharma-custom.crt -req -signkey lasharma-custom.key -days 3650
5. Four file will be created at [apache 2.2 path]/bin name lasharma-custom.crt, lasharma-lasharma.csr, lasharma-custom.key, lasharma-custom.pem
6. open [apache 2.2 path]/config/extra/httpd-ssl.conf file and add following information
uncomment Listen 443
update certificate path SSLCertificateFile "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/bin/lasharma-custom.crt"
update key path SSLCertificateKeyFile "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/bin/lasharma-custom.key"
add ProxyPass /lasharma ajp://10.97.98.184:9109/lasharma
ProxyPassReverse /lasharma ajp://10.97.98.184:9109/lasharma
7. add LoadModule ssl_module modules/mod_ssl.so module above httpd-custom.conf file
8. add LoadModule rewrite_module modules/mod_rewrite.so to httpd-custom.conf file
8. add lines to virtual host for redirection of http request
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI
9. httpd-custom.conf file will have virtual host will become like below
<VirtualHost *:80>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
ProxyPass /lasharma ajp://10.97.98.184:9109/lasharma
8. add LoadModule rewrite_module modules/mod_rewrite.so to httpd-custom.conf file
8. add lines to virtual host for redirection of http request
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI
9. httpd-custom.conf file will have virtual host will become like below
<VirtualHost *:80>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
ProxyPass /lasharma ajp://10.97.98.184:9109/lasharma
ProxyPassReverse /lasharma ajp://10.97.98.184:9109/lasharma
ServerName www.lasharma.com
</VirtualHost>
10. start server
</VirtualHost>
10. start server
