I have a simple LAMP stack with httpd/Apache installed on Centos 6.5. I've set my vhost up in /etc/httpd/sites-available/acute.conf like so:
<VirtualHost *:80>
ServerName acutemedical.co
ServerAlias acutemedical.co
DocumentRoot /var/www/html
ErrorLog /var/www/log/error.log
CustomLog /var/www/log/requests.log combined
Redirect permanent / https://acutemedical.co/
</VirtualHost>
<VirtualHost *:443>
ServerName acutemedical.co
ServerAlias acutemedical.co
DocumentRoot /var/www/html
ErrorLog /var/www/log/error.log
CustomLog /var/www/log/requests.log combined
SSLEngine on
SSLCertificateFile /etc/httpd/ssl/server.crt
SSLCertificateKeyFile /etc/httpd/ssl/server.key
</VirtualHost>
Also here is the output of my iptables ruleset:
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:80
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:443
When visiting the site at port 80 without the redirect the site will come up no problem. When visiting the site on port 443 it gets a connection refused. Same problem when I leave the redirect directive in the 80 vhost block.
I've tried to curl each url with http and https and only http works.
I've set this up before but it's been a year or so (I'm mostly using nginx now). So I was wondering if anyone can look at my configuration and tell me what I'm doing wrong.
I figured this out pretty quickly, in my httpd.conf I had the ports bound there instead of the vhost. So I removed them from httpd.conf and added Listen 80 and Listen 443 to the vhost file and it worked.
I suspect that you haven't got the following enabled:
There should be something in your error log (ssl_error_log) explaining why there is nothing listening on port 443.
But you're paths look very un-CentOS/RHEL6 like (which don't have a sites-available structure, and don't log to /var/www/log/ ), so I'm willing to bet that the rest of your configuration is also to be not-as-expected.
PS. The ServerAlias lines are redundant.