Problem setting up Apache, tomcat, SSL.(146) Connection refused.

Hi Experts,

I have successfully setting up my apache2 web server, http://www.domainname.com which is running jsp (tomcat5.0, jk2 connector).
Now, I need to set up my SSL at https://www.domainname.com.
What I have done is:
1) Create a local key pair using the following command:
openssl genrsa -dec3 -out domainname.com.key 1024
2) Create a self-signed certificate
openssl req -new -key domainname.key -x509 -out sslname.crt

3) Edit my httpd.conf
a) Enable my SSL
<IfDefine SSL>
LoadModule ssl_module modules/mod_ssl.so
</ifDefine>

b) Configure my site
<IfDefine SSL>
<VirtualHost 111.111.111.111:443>
ServerName      www.domainname.com
DocumentRoot    /www/tomcat5.0/webapps/sitename
DirectoryIndex  index.jsp
Errorlog        logs/sitename-error_log
TransferLog     logs/sitename-access_log
SSLEngine       on
SSLCertificateFile      /usr/local/ssl/bin/ssslname.crt
SSLCertificateKeyFile   /usr/local/ssl/bin/www.domainame.com.key
SetEnvIf User-Agent     ".*MSIE.*" nokeepalive ssl-unclean-shutdown
</VirtualHost>
</IfDefine>

4) Reboot Apache

However, when I try to connect to https://www.domainname.com
The error message was (146) Connection refused.

My questions are:
1) Are my above configuration correct?
2) Do I have to do any setting in my tomcat server.xml?
If yes, what are the setting
3) Do I need to do any setting for the JK2 connector?
If yes, what are the setting.

Thank you very much


totoronAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mrielfCommented:
Add this line to your httpd.conf file:

Listen 443
0
totoronAuthor Commented:
Thanks. I have added the above line.

However I still encounter some problem.
I could see my web site at http://www.domainname.com:443
But I couldn't see any SSL secure sign at the bottom of my IE.

And I couldn't view it with https://www.domainname.com

Any solutions?
0
mrielfCommented:
Instead

      <IfDefine SSL>
      LoadModule ssl_module modules/mod_ssl.so
      </ifDefine>

just write:

      LoadModule ssl_module modules/mod_ssl.so

0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

mrielfCommented:
Or if you need <IfDefine SSL>

then call apache with option: -D SSL
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mrielfCommented:
And some error log would be great why https://www.domainname.com isn't works...
0
totoronAuthor Commented:
Thanks. It works. if I specified it with -D SSL.
By the way. Is it possible to make that I just need the login page to enable the https ?
while the rest of the pages I don't need https
0
mrielfCommented:
There are many solution, but if you need only one page to be server through ssl, then i thin best solution is check inside file.

PHP example:

Put this code at begining of your php file:

      <?php
      if ( !isset($_SERVER['HTTPS']) || strtolower($_SERVER['HTTPS']) != 'on' ) {
         header ('Location: https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
         exit();
      }
      ?>


0
totoronAuthor Commented:
thanks a million
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Apache Web Server

From novice to tech pro — start learning today.