Score:0

ssl problem with other virtual hosts

be flag

i have 5 virtual hosts, one is the hostname on the vps server. it also has a ssl certificate.

the other 4 dont have ssl, now when i try view any of the others i get this

Your browser sent a request that this server could not understand. Reason: You're speaking plain HTTP to an SSL-enabled server port. Instead use the HTTPS scheme to access this URL, please.

ssl virutal host config as follows

<VirtualHost SERVERIP:80> 
  ServerName www.MYSITE1.com
  ServerAlias MYSITE1.com
  SSLEngine                on
  DocumentRoot /var/www/html/MYSITE1.com/public_html
  SSLCertificateFile       /etc/ssl/certificate.crt
  SSLCertificateKeyFile    /etc/ssl/private/private.key
  SSLCertificateChainFile  /etc/ssl/ca_bundle.crt

  Redirect permanent / https://URLREMOVED.com/
</VirtualHost>

<VirtualHost SERVERIP:443>
  ServerName www.MYSITE1.com
  ServerAlias MYSITE1.com
  DocumentRoot /var/www/html/MYSITE1.com/public_html
  SSLEngine                on
  SSLCertificateFile       /etc/ssl/certificate.crt
  SSLCertificateKeyFile    /etc/ssl/private/private.key
  SSLCertificateChainFile  /etc/ssl/ca_bundle.crt


  Protocols h2 http/1.1

  <If "%{HTTP_HOST} == 'www.MYSITE1.com'">
    Redirect permanent / https://MYSITE1.com/
  </If>

  # SSL Configuration

  # Other Apache Configuration

</VirtualHost>




 
 AND one of the other configs, the rest are similar, only difference is the domain and path. everyconfig has the server ip at the start instead of *

<VirtualHost SERVERIP.:80>
    ServerAdmin [email protected]
    ServerName  www.MYSITE2.co.uk
    ServerAlias mysite2.co.uk
    DocumentRoot /var/www/html/mysite2./public_html
    RewriteEngine on
    RewriteCond %{HTTP_HOST} !^www\.mysite2.\.co.uk$ [NC]
    RewriteRule ^(.*)$ http://www.mysite2.co.uk/$1 [R=301,L]    
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>``
in flag
Could you update your question to include the file names for the virtual host configurations and point out which one has the SSL certificate information? This may be an issue of overzealous routing in Apache
be flag
the one at the top is the one with the ssl certificate. the config at the bottom is written the same as the other non ssl, just the names are different. they all use the same ip at the start of the config
in flag
That’s the likely culprit, then. Move the file with the SSL configuration to the end with a `999` or a `zzz` prefix. Apache will try to determine where to route traffic based on the domain name and order of the config files. By having the “simpler” domains first, Apache should handle the traffic properly. Be sure to `a2dissite`, rename, `a2ensite`, then restart Apache (in that order) to reduce the chance of configurations being improperly deactivated
be flag
Thanks for taking the time to reply mate, some of that has went right over my head, 999,zzz? sorry, am still newish to all this. each site has there own virtual host config. the top in the quote above thats seperated by "AND one of the other configs, the rest are similar" is the ssl config for the site, the other virutal hosts use a very similar config to the one posted at the bottom except they have there own path, domain etc. sorry if posts havent helped build a proper picture of the problem
be flag
ive tried to edit the the first post alittle, hope it helps. thanks
be flag
fixed i think :) cheers corrected the ssl virutal host
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.