LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices


Reply
  Search this Thread
Old 01-04-2018, 04:04 PM   #1
dalgrim
Member
 
Registered: Nov 2014
Location: Michigan, USA
Distribution: slackware14.1 x64
Posts: 37

Rep: Reputation: Disabled
Ubuntu 16.04.3 LTS - Apache - SSL - Can not connect to site


I have a Ubuntu 16.04.3 LTS server running apache2. It is serving multiple sites. I am unable to connect to any of them. It is forcing a redirect to https:// and then giving a "Secure Connection Failed" error message. SSL is enabled with "a2enmod ssl"

Check: http://magmaguy.com/ and http://matecraft.org

I've checked the /etc/apache2/apache2.conf file. (#comments removed)
Code:
<Directory />
        Options FollowSymLinks
        AllowOverride None
        Require all denied
</Directory>

<Directory /usr/share>
        AllowOverride None
        Require all granted
</Directory>

<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
</Directory>
AccessFileName .htaccess
<FilesMatch "^\.ht">
        Require all denied
</FilesMatch>
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
IncludeOptional conf-enabled/*.conf
IncludeOptional sites-enabled/*.conf
The {apache2}/sites-enabled/ .conf files.
site1:
Code:
<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/matecraft.org/
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
        ServerName matecraft.org
        ServerAlias www.matecraft.org
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
site2:
Code:
<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/magmaguy.com/
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
        ServerName magmaguy.com
        ServerAlias www.magmaguy.com

RewriteEngine on
RewriteCond %{SERVER_NAME} =www.magmaguy.com [OR]
RewriteCond %{SERVER_NAME} =magmaguy.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
Site2 with SSL (yes it's enabled)
Code:
<IfModule mod_ssl.c>
<VirtualHost *:443>
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/magmaguy.com/
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
        ServerName magmaguy.com
        ServerAlias www.magmaguy.com

Include /etc/letsencrypt/options-ssl-apache.conf
Include /etc/letsencrypt/options-ssl-apache.conf
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/magmaguy.com-0001/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/magmaguy.com-0001/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>
nmap from a remote computer shows port 80 and 443 open.

snipped
Code:
netstat -ntlp | grep LISTEN
tcp6       0      0 :::80                   :::*                    LISTEN      1913/apache2
tcp6       0      0 :::443                  :::*                    LISTEN      1913/apache2
there is no ipv4 entry there.

The SSL setup was done by following these:
Link1
Link2
using letsencrypt.

I'm not sure where else to look, what else to try.

-Brian
 
Old 01-05-2018, 04:06 PM   #2
dalgrim
Member
 
Registered: Nov 2014
Location: Michigan, USA
Distribution: slackware14.1 x64
Posts: 37

Original Poster
Rep: Reputation: Disabled
Close unresolved. had to completely remove and reinstall apache to fix it.
 
Old 03-01-2018, 12:43 AM   #3
Hostech_Support
Member
 
Registered: Oct 2017
Location: India
Posts: 41

Rep: Reputation: Disabled
Quote:
Originally Posted by dalgrim View Post
I have a Ubuntu 16.04.3 LTS server running apache2. It is serving multiple sites. I am unable to connect to any of them. It is forcing a redirect to https:// and then giving a "Secure Connection Failed" error message. SSL is enabled with "a2enmod ssl"

Check: http://magmaguy.com/ and http://matecraft.org

I've checked the /etc/apache2/apache2.conf file. (#comments removed)
Code:
<Directory />
        Options FollowSymLinks
        AllowOverride None
        Require all denied
</Directory>

<Directory /usr/share>
        AllowOverride None
        Require all granted
</Directory>

<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
</Directory>
AccessFileName .htaccess
<FilesMatch "^\.ht">
        Require all denied
</FilesMatch>
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
IncludeOptional conf-enabled/*.conf
IncludeOptional sites-enabled/*.conf
The {apache2}/sites-enabled/ .conf files.
site1:
Code:
<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/matecraft.org/
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
        ServerName matecraft.org
        ServerAlias www.matecraft.org
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
site2:
Code:
<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/magmaguy.com/
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
        ServerName magmaguy.com
        ServerAlias www.magmaguy.com

RewriteEngine on
RewriteCond %{SERVER_NAME} =www.magmaguy.com [OR]
RewriteCond %{SERVER_NAME} =magmaguy.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
Site2 with SSL (yes it's enabled)
Code:
<IfModule mod_ssl.c>
<VirtualHost *:443>
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/magmaguy.com/
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
        ServerName magmaguy.com
        ServerAlias www.magmaguy.com

Include /etc/letsencrypt/options-ssl-apache.conf
Include /etc/letsencrypt/options-ssl-apache.conf
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/magmaguy.com-0001/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/magmaguy.com-0001/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>
nmap from a remote computer shows port 80 and 443 open.

snipped
Code:
netstat -ntlp | grep LISTEN
tcp6       0      0 :::80                   :::*                    LISTEN      1913/apache2
tcp6       0      0 :::443                  :::*                    LISTEN      1913/apache2
there is no ipv4 entry there.

The SSL setup was done by following these:
Link1
Link2
using letsencrypt.

I'm not sure where else to look, what else to try.

-Brian
>> You can follow these steps:

<VirtualHost *:80>
ServerAdmin webmaster@yourdomain.com
DocumentRoot /var/www/vhost1
ServerName vhost1.yourdomain.com
DirectoryIndex index.php
ErrorLog /var/log/apache2/vhost1-error.log
<Location />
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R]
</Location>
</VirtualHost>
<VirtualHost *:443>
ServerAdmin webmaster@yourdomain.com
DocumentRoot /var/www/vhost1
ServerName vhost1.yourdomain.com
DirectoryIndex index.php
ErrorLog /var/log/apache2/vhost1-error.log
CustomLog /var/log/apache2/vhost1-access.log combined
SSLEngine On
SSLCertificateFile /etc/apache2/ssl/crt/vhost1.crt
SSLCertificateKeyFile /etc/apache2/ssl/key/vhost1.key
<Location />
SSLRequireSSL On
SSLVerifyClient optional
SSLVerifyDepth 1
SSLOptions +StdEnvVars +StrictRequire
</Location>

hope this helps
 
Old 03-01-2018, 07:28 AM   #4
dalgrim
Member
 
Registered: Nov 2014
Location: Michigan, USA
Distribution: slackware14.1 x64
Posts: 37

Original Poster
Rep: Reputation: Disabled
Thanks for the reply but The issue was some strange incompatibility with other packages. Even once removed they left crap somewhere. I had to remove apache and all it's configs. remove the other packages and all their configs. reinstall apache and recreate the configs. only then did it work. Each site's .conf files were fine. I wish I knew what file exactly caused it but I needed it running.

-Brian
 
  


Reply



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
One site can't connect to database via apache but via cli pingu Linux - Server 14 09-15-2014 05:13 AM
Apache Basics Ubuntu LTS 14.04.1 LTS wh33t Linux - Server 3 08-28-2014 08:01 PM
help! can't connect to our development web site with new SSL Configuration bweaver Linux - Newbie 3 10-02-2012 05:22 AM
Apache with SSL: Can't connect to the site! djbon2112 Linux - Software 4 11-30-2009 08:08 PM
linux-apache-unable to connect to site derekw Linux - Networking 2 09-18-2002 04:50 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu

All times are GMT -5. The time now is 07:47 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