Score:0

Configuring SSL With Virtual Hosts under Apache and ubuntu

cn flag

I've got two websites being served from a ubuntu instance.

So, https://siteone.com and https://sitetwo.com both work fine.

My subdomain were fine https://subdomain.siteone.com and https://subdomain.sitetwo.com before I moved https://sitetwo.com to cloudfare.

SInce I did that The issue is https://subdomain.sitetwo.com displays https://siteone.com.

I have one public IP address available.

    <VirtualHost *:80>

ServerAdmin [email protected]
ServerName sitetwo.ca
ServerAlias www.sitetwo.ca
DocumentRoot /var/www/boom/
 <Directory /var/www/boom/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            allow from all
        </Directory>
ErrorLog ${APACHE_LOG_DIR}/sitetwo.ca_error.log
CustomLog ${APACHE_LOG_DIR}/sitetwo.ca_access.log combined

RewriteEngine on
RewriteCond %{SERVER_NAME} =www.sitetwo.ca [OR]
RewriteCond %{SERVER_NAME} =sitetwo.ca
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>


<VirtualHost *:80>

ServerAdmin [email protected]
ServerName label.sitetwo.ca

DocumentRoot /var/www/html/laravel-db-import/public/
 <Directory /var/www/html/laravel-db-import/public/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            allow from all
        </Directory>
ErrorLog ${APACHE_LOG_DIR}/label.sitetwo.ca_error.log
CustomLog ${APACHE_LOG_DIR}/label.sitetwo.ca_access.log combined

RewriteEngine on
RewriteCond %{SERVER_NAME} =sitetwo.ca [OR]
RewriteCond %{SERVER_NAME} =label.sitetwo.ca [OR]
RewriteCond %{SERVER_NAME} =www.sitetwo.ca
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

</VirtualHost>
vidarlo avatar
ar flag
Why do you use rewrites? Create *two* vhosts, one for each domain. CF preserves Host header, and handles SNI. So does all modern browsers.
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.