As title says,
I want to set my apache to listen on 443, and will configure SSL.
So, My Question is :-
1). Does that mean, i will not have port 80 or any other port which is no ssl ? 2). My site can only be accessed via https and no http ? Thanks
I would advice against doing this using an iptables redirect. The reason is that when someone browses your site using HTTP, their browser is not expecting an SSL session handshake. It may work, but it's definitely not guaranteed to.
Instead, I'd have a separate Apache instance (or a VirtualHost) that listens on port 80. That apache instance/VH should be configured to only issue a redirect to the SSL-enabled site, like this:
RedirectMatch /(.*) https://www.example.com/$1
That way the browser will understand that it's being sent off to an SSL site, and there will be no problem with the SSL negotiation.
If you configure apache with no listening configuration on port 80 and ensure that you configure it to listen on port 443 with ssl correctly then yes, your server will not listen on any non-ssl ports.
root@linux# iptables -t NAT -a PREROUTING -p tcp --dport 80 --to-port 443 -j REDIRECT
Jul 12, 2013 at 10:34
You cannot redirect the HTTP requests to HTTPS without initializing the SSL connetion. So, iptables will not help you. You need to do that with your web server.