Forum Moderators: phranque

Message Too Old, No Replies

apache listening on port 443 but https url not working

         

bhaceg

10:39 pm on May 25, 2010 (gmt 0)

10+ Year Member



Hi friends,

I have a doubt. I installed the apache web server on my RHEL 5.5 server and have set the listening port to 443 i.e in httpd.conf i have given "Listen 443" instead of Listen 80 because someother application is running on port 80. I have created a PHP web application and it works fine when i run it like

http://example.com:443/

The application which runs on port 80 redirects all the http requests to port 443.

So when i type http://example.com/ (please note tat i ve not given the port number ) the url changes to i.e requests gets redirected to https://example.com/ (i heard https corresponds to port 443). i was expecting to see the page corresponding to http://example.com:443/
But even though the url changes from http to https i don see the page that i saw in http://example.com:443/.

the following is the error message i get in firefox corresponding to the https url..

Secure Connection Failed

An error occurred during a connection to dev-cir.example.com.

The client has encountered bad data from the server.

(Error code: ssl_error_bad_server)
* The page you are trying to view can not be shown because the authenticity of the received data could not be verified.

* Please contact the web site owners to inform them of this problem. Alternatively, use the command found in the help menu to report this broken site.


please do let me know wat i have to do to get the required page in the url startin with [.....]
i searched in net but couldn't find the solution.. Please do help me out..

Thank you so much in advance for the help..

[edited by: bhaceg at 10:51 pm (utc) on May 25, 2010]

[edited by: jdMorgan at 11:25 pm (utc) on May 25, 2010]
[edit reason] Please use example.com only. See TOS. [/edit]

bhaceg

10:43 pm on May 25, 2010 (gmt 0)

10+ Year Member



I am sorry i dont know much about SSL or VirtualHost or other such apache config stuff as i m new to ths..please do excuse me if the question is silly..but please do help me out..

jdMorgan

11:07 pm on May 25, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You may have this forum confused with instant messaging.
Please allow up to 48 hours for a reply (I you need a good one)... :)

Your problem is quite puzzling actually... works with port 443 appended but not with https.
That should be telling me something, but I'm drawing a blank right now.

The only thing that's tickling my brain right now is that it is not usual to use the "Listen" directive, but rather to use a separate VirtualHost, and define it as

<VirtualHost 192.168.0.1:443>

or similar.

Perhaps someone who's better with SSL will drop in and help out here. In the meantime, you may wish to review the tutorials at Apache.org concerning setting up virtualhosts and SSL.

Jim

bhaceg

12:15 am on May 26, 2010 (gmt 0)

10+ Year Member



Hi Jim,

Thank you so much for the reply.

The only thing that's tickling my brain right now is that it is not usual to use the "Listen" directive, but rather to use a separate VirtualHost, and define it as

<VirtualHost 192.168.0.1:443>

or similar.


But don't we compulsorily need the listen directive. I found the following in the apache site.

Listen does not implement Virtual Hosts. It only tells the main server what addresses and ports to listen to. If no <VirtualHost> directives are used, the server will behave the same for all accepted requests. However, <VirtualHost> can be used to specify a different behavior for one or more of the addresses and ports. To implement a VirtualHost, the server must first be told to listen to the address and port to be used. Then a <VirtualHost> section should be created for a specified address and port to set the behavior of this virtual host. Note that if the <VirtualHost> is set for an address and port that the server is not listening to, it cannot be accessed.

I am ok with the server(listen at port 443) behaving same for accepted http requests. So I guess I don't need the VirtualHost. But I guess I compulsorily need Listen 443 to make apache listen at that port. So I am not sure whether VirtualHost will solve my problem.

Friends please do lemme know what i ve to do to solve the problem.

Thanks,
JVB.

jdMorgan

12:19 am on May 26, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<VirtualHost> can be used to specify a different behavior for one or more of the addresses and ports.

Well, the "different behaviour" I'm thinking of here is http vs. https.

All I can tell you is what I posted above:
it is not usual to use the "Listen" directive, but rather to use a separate VirtualHost, and define it as

Most sites that I've seen supporting SSL and non-SSL use two vHosts -- One for SSL and one for non-SSL.

Jim