LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 08-28-2018, 08:05 AM   #1
Mario Lima
LQ Newbie
 
Registered: Mar 2018
Posts: 22

Rep: Reputation: Disabled
Sites SSL Certification


Hello,

I am installing SSL Certification on my Linux Centos Server. And I am trying the first Domains. It is almost working. But I have one strange problem. If I use a URL to the Site root (www) it comes as Secure. But if I use a URL to any internal directory it comes as Unsecure, depending on using www or a slash at the end.

Please try it in your Chrome Browser, but, clear its Cache memory between the tests. I have added SSL to 2 of our Sites:

segurosagro.com.br
multisites.com.br

And I created a simple directory called testredirect which has just an index.html file with an image.

1) segurosagro.com.br/testredirect

It comes as Unsecure.

2) segurosagro.com.br/testredirect/

It works, and comes as Secure.

3) www.segurosagro.com.br/testredirect

It also works, and comes as Secure.

In the same way:

1) multisites.com.br/testredirect

It comes as Unsecure.

2) multisites.com.br/testredirect/

It works, and comes as Secure.

3) www.multisites.com.br/testredirect

It also works, and comes as Secure.

My actual httpd.conf <virtualhosts> entries for segurosagro.com.br and multisites.com.br are as below. You will see that they are slightly different. This is due to tests I was doing trying to solve the problem:

#--------------------------------------------------------
# multisites.com.br
#--------------------------------------------------------
<virtualhost 66.226.75.86:80>
ServerAdmin webmaster@multisitesdominios.com.br
ServerName www.multisites.com.br
ServerAlias multisites.com.br
ServerAlias www.multisites.net.br
DocumentRoot /var/www/html/multisites/www
ScriptAlias /cgi-bin/ /var/www/html/multisites/www/cgi-multisites/
<Directory "/var/www/html/multisites/www/cgi-multisites/">
Options ExecCGI Includes
AllowOverride None
</Directory>
ErrorLog logs/multisites-error-log
TransferLog logs/multisites-access-log
#
#Redirection to https
#
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
</virtualhost>

#--------------------------------------------------------
# segurosagro.com.br
#--------------------------------------------------------
<virtualhost 66.226.75.86:80>
ServerAdmin webmaster@multisitesdominios.com.br
ServerName www.segurosagro.com.br
ServerAlias segurosagro.com.br
DocumentRoot /home/segurosagro/www
ScriptAlias /cgi-bin/ /home/segurosagro/www/cgi-segurosagro/
<Directory "/home/segurosagro/www/cgi-segurosagro/">
Options ExecCGI Includes
AllowOverride None
</Directory>
TransferLog logs/segurosagro-access-log
#
#Redirection to https
#
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
</virtualhost>

Thanks for any help.
 
Old 08-28-2018, 03:19 PM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Hi,

Visiting https://segurosagro.com.br, I get:
Quote:
segurosagro.com.br uses an invalid security certificate.
The certificate is only valid for www.segurosagro.com.br.
Same for the other site.
This happens because both certificates are issued for the hosts with the www at the beginning (www.segurosagro.com.br, www.multisites.com.br).
Since they are from Letsencrypt, you can re-issue them for both the www and non-www hostnames.

Regards
 
Old 08-29-2018, 04:35 AM   #3
Mario Lima
LQ Newbie
 
Registered: Mar 2018
Posts: 22

Original Poster
Rep: Reputation: Disabled
Hi, bathory,

Yes, this really makes sense. My technician will not be here for a couple of days. Based on the httpd.conf records I listed within this post, could you tell me please where must I implement what you told me to?
Thanks a lot.
Mario./
 
Old 08-29-2018, 05:21 AM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
Originally Posted by Mario Lima View Post
Hi, bathory,

Yes, this really makes sense. My technician will not be here for a couple of days. Based on the httpd.conf records I listed within this post, could you tell me please where must I implement what you told me to?
Thanks a lot.
Mario./
You don't have to do anything with the apache config files.

You (or your technician), must re-issue new certificates from Let’s Encrypt for both domains and for both hosts (with or without the www at the beginning) within each domain.

Assuming that your technician has installed certbot using defaults and you don't want to wait for him, you can run:
Code:
sudo certbot --apache -d segurosagro.com.br -d www.segurosagro.com.br
to create new certs for the 1st pair of hosts. Of course do the same for the 2nd pair.

Attn: before anything else, don't forget to backup apache config files (under /etc/httpd/conf.d) and/or letsencrypt files (/etc/letsencrypt).

After running certbot you need to restart apache for the changes to apply.


Regards
 
  


Reply

Tags
certification, ssl



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ssl public certification services nico34 General 2 04-28-2012 10:48 AM
Sites that use SSL needlessly Coresay Linux - Security 20 04-27-2011 08:42 AM
need help with apach virtual hosts ssl/non ssl sites danthach Linux - Networking 3 05-25-2006 06:40 AM
How to have SSL on two different pages/sites? Manuel-H Linux - General 1 08-05-2003 08:53 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 08:18 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration