apache - httpd redirects with SSL and subdomains/vhosts -
i'm trying setup http -> https redirected subdomains on website, being served apache (version: 2.2.31). purchased wildcard ssl certificate installed correctly main site (www.domain.com
) because green lock next address, part should done.
the issue: browsing subdomain.domain.com
redirects www.domain.com
, can't figure out why. i've been reading , following this page several others similar content, i'm missing key ingredient.
the main site served /var/www/html
, subdomain served /var/www/vhosts/subdomain
. also, i'm getting error:
[warn] _default_ virtualhost overlap on port 443, first has precedence
here's vhost section of /etc/httpd/conf/httpd.conf
:
namevirtualhost *:80 <virtualhost *:80> servername www.domain.com serveralias www.domain.com #redirect permanent / https://www.domain.com redirect 302 / https://www.domain.com </virtualhost> <virtualhost *:80> servername subdomain.domain.com serveralias subdomain.domain.com #redirect permanent / https://subdomain.domain.com redirect 302 / https://subdomain.domain.com </virtualhost>
and here's /etc/httpd/conf.d/ssl.conf
:
<virtualhost *:443> servername www.domain.com serveralias www.domain.com documentroot /var/www/html ... sslengine on sslprotocol -sslv2 sslciphersuite all:!adh:!export:!sslv2:rc4+rsa:+high:+medium:+low sslcertificatefile /path/to/cert sslcertificatekeyfile /path/to/key sslcertificatechainfile /path/to/bundle </virtualhost> <virtualhost *:443> servername subdomain.domain.com serveralias subdomain.domain.com documentroot /var/www/vhosts/subdomain ... sslengine on sslprotocol -sslv2 sslciphersuite all:!adh:!export:!sslv2:rc4+rsa:+high:+medium:+low sslcertificatefile /path/to/cert sslcertificatekeyfile /path/to/key sslcertificatechainfile /path/to/bundle </virtualhost>
and here's apachectl -s
output (with domain name redacted/substituted):
any appreciated.
=======================================================================
edit: removed word permanent, cleared cache, , problem persists. seems has warning, right?
also, successful response regardless of subdomain
use when doesn't exist. can literally type whatever want subdomain
, goes main site. http://<anything>.domain.com
, https://<anything>.domain.com
both load main site https.
the problem simple, elusive, @ least me. in /etc/httpd/conf.d/ssl.conf
, needed add following line virtualhost configurations distinct:
namevirtualhost *:443
now works expected.
Comments
Post a Comment