I have been reading through all the discussions on the subject and decided to use the Redirect method in the httpd.conf file with no luck... So I came back here to this knowledgable crowd.
We have a service let's call it "host1" (https based) that runs on a Centos 6.x We decided to add our website there as well to leverage a purchased wildcard SSL certificates that is nicely working for the two SSL accesses when connecting in https.
Unfortunately our website is not accessible and times-out when a user is typing ourdomain.com, www.ourdomain.com, or uses http for ourdomain.com or www.ourdomain.com. Everything works fine with https for ourdomain.com, www.ourdomain.com and host1.ourdomain.com.
Below you will find the httpd.conf and ssl.conf truncated to the Virtual Hosts areas in both and hiding our specific details.
I get the following error from httpd with this configuration:
This one is not happening anymore, thanks for the hints
Starting httpd: (98)Address already in use: make_sock: could not bind to address [::]:80
------------ Start httpd.conf ------------------
# >>httpd configuration truncated down to Virtual Hosts
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
<VirtualHost *:80>
ServerName www.ourdomain.com
Redirect permanent / https://www.ourdomain.com/
</VirtualHost>
------------ End httpd.conf ------------------
------------ Start ssl.conf to manage 443 and ssl certificates------------------
# >>SSL Configuration Truncated up to Listen 443 and Virtual Hosts
Listen 443
#Listen for virtual host requests on all IP addresses
NameVirtualHost *:443
# >>SSL Config ...
##
## SSL Virtual Host Context
##
<VirtualHost *:443>
DocumentRoot /var/www/html/dir1
ServerName host1.ourdomain.com
ServerAlias host1.ourdomain.com
ErrorLog logs/ssl_error_log
TransferLog logs/ssl_access_log
LogLevel warn
SSLEngine on
# >>SSL Certificates Config ... Truncated
</VirtualHost>
<VirtualHost *:443>
DocumentRoot /var/www/html/dir2
ServerName ourdomain.com
ServerAlias ourdomain.com www.ourdomain.com
ErrorLog logs/ssl_error_log
TransferLog logs/ssl_access_log
LogLevel warn
SSLEngine on
# >>SSL Certificates Config ... Truncated
</VirtualHost>
------------ End ssl.conf ------------------
Where is the issue?? I would not want to settle with .htaccess as I want to avoid having AllowOverride All impacting our host1 service.
Thanks.
Oly
----- Added section for netstat 2nd request by ngn
# netstat -ant | grep 80
tcp 0 0 :::80 :::* LISTEN
----- Added section for lsof request by Hbruijn - any idea?
# lsof -iTCP:80
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
httpd 24331 root 5u IPv6 5381394 0t0 TCP *:http (LISTEN)
httpd 24334 apache 5u IPv6 5381394 0t0 TCP *:http (LISTEN)
httpd 24335 apache 5u IPv6 5381394 0t0 TCP *:http (LISTEN)
httpd 24336 apache 5u IPv6 5381394 0t0 TCP *:http (LISTEN)
httpd 24337 apache 5u IPv6 5381394 0t0 TCP *:http (LISTEN)
httpd 24338 apache 5u IPv6 5381394 0t0 TCP *:http (LISTEN)
httpd 24339 apache 5u IPv6 5381394 0t0 TCP *:http (LISTEN)
httpd 24340 apache 5u IPv6 5381394 0t0 TCP *:http (LISTEN)
httpd 24341 apache 5u IPv6 5381394 0t0 TCP *:http (LISTEN)
httpd 25323 apache 5u IPv6 5381394 0t0 TCP *:http (LISTEN)
httpd 25325 apache 5u IPv6 5381394 0t0 TCP *:http (LISTEN)
httpd 25326 apache 5u IPv6 5381394 0t0 TCP *:http (LISTEN)
New addition to this issue
Here are the httpd -S results, all seem ok from httpd standpoint. But connecting to 'http : //ourdomain.com' or 'http : //www.ourdomain.com' stalls in all browsers... Rewrite with https is not working at all.
wildcard NameVirtualHosts and _default_ servers:
*:80 is a NameVirtualHost
default server ourdomain.com (/etc/httpd/conf/httpd.conf:1032)
port 80 namevhost ourdomain.com (/etc/httpd/conf/httpd.conf:1032)
alias ourdomain.com
wild alias *.ourdomain.com
*:443 is a NameVirtualHost
default server host1.ourdomain.com (/etc/httpd/conf.d/ssl.conf:40)
port 443 namevhost host1.ourdomain.com (/etc/httpd/conf.d/ssl.conf:40)
alias host1.ourdomain.com
port 443 namevhost ourdomain.com (/etc/httpd/conf.d/ssl.conf:95)
alias ourdomain.com
alias www.ourdomain.com
Syntax OK
httpd.conf for port 80
<VirtualHost *:80>
ServerName ourdomain.com
ServerAlias ourdomain.com *.ourdomain.com
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
</VirtualHost>