0

Ubantu 20.04 LTS I have set up this server to replace a very old Mac OS server that will not serve a current version of TLS. While I was using Apache on the Mac, the version on the Ubantu requires different configuration, and I have overcome much of my issues. I have a number of sites that are running properly and a number of redirects that take the user from ***.com to ###.com I have site that I installed and configured and checked that is serving properly with https that I need to send a number of other sites to. I have set up the redirect on that site in a similar way to the ones that are working, yet I am not able to serve the proper site, they go to the default. I have configured and reconfigured with what I thought was working settings and yet I cannot seem to get it to work. This is the "target" conf file that is working:

<VirtualHost *:80> ServerName wescrap.ca ServerAlias www.wescrap.ca ServerAdmin webmaster@wescrap.ca DocumentRoot /var/www/wescrap.ca/public_html Redirect permanent / https://wescrap.ca

<Directory /var/www/wescrap.ca/public_html>
    Options -Indexes +FollowSymLinks
    AllowOverride All
</Directory>

ErrorLog ${APACHE_LOG_DIR}/wescrap.ca-error.log
CustomLog ${APACHE_LOG_DIR}/-access.log combined </VirtualHost>

<VirtualHost *:443> ServerName wescrap.ca DocumentRoot /var/www/wescrap.ca/public_html

SSLEngine on SSLCertificateFile /var/www/wescrap.ca/public_html/SSL/wescrap_ca.crt SSLCertificateKeyFile /var/www/wescrap.ca/public_html/SSL/wescrap_ca.key SSLCertificateChainFile /var/www/wescrap.ca/public_html/SSL/wescrap_ca.ca-bundle

This is the code for the redirect that is not:

<VirtualHost *:80> ServerName toronto-scrap.com ServerAlias www.toronto-scrap.com Redirect permanent / http://wescrap.ca/ DocumentRoot /var/www/wescrap.ca/public_html

Would be most grateful for some suggestions as to a fix. Thanks!

0

Looking at the record for toronto-scrap.com, I believe you're missing an s:

<VirtualHost *:80>
    ServerName toronto-scrap.com
    ServerAlias www.toronto-scrap.com
    Redirect permanent / https://wescrap.ca/
    DocumentRoot /var/www/wescrap.ca/public_html
</VirtualHost>

The Redirect was originally pointing to http rather than https.

Remember to reload Apache after making these changes:

sudo service apache2 restart
5
  • No joy on that. Same ending, goes to the default page for the server. I swap the DNS and check, then send it back the Mac server. This is a real puzzle! – intrrnet Jan 21 at 3:15
  • Have you verified that the .conf file with this rule is enabled? Can you update your question to include the output of sudo a2query -s? This will show the virtual host files that are currently enabled. – user1091774 Jan 21 at 3:37
  • It's not on that list! Will re-run the setup. Hopefully that will be the solution. – intrrnet Jan 21 at 4:11
  • Just enable the file with sudo a2ensite /etc/apache2/sites-available/999-toronto.conf (change the file to what it actually is) and then restart Apache: sudo service apache2 restart. – user1091774 Jan 21 at 4:14
  • Yup, that was it. Does the phrase "code blindness" work better than "how the heck did I miss that"? Thanks. It's always the step you thought you had taken that makes the difference when something goes wrong. Thank you again! – intrrnet Jan 21 at 4:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.