1

I'm trying to setup SSL on an ubuntu server. I've generated a key and certificate with the following commands openssl genrsa -out mydomain.key 1024 and openssl req -new -key mydomain.key -x509 -out mydomain.crt. I added LoadModule ssl_module /usr/lib/apache2/modules/mod_ssl.so to httpd.conf, and the relevant(I think) excerpt from my httpd.conf is

LoadModule ssl_module /usr/lib/apache2/modules/mod_ssl.so NameVirtualHost *:80 NameVirtualHost *:443 Listen 80 Listen 443 # # NOTE: NameVirtualHost cannot be used without a port specifier # (e.g. :80) if mod_ssl is being used, due to the nature of the # SSL protocol. # # # VirtualHost example: # Almost any Apache directive may go into a VirtualHost container. # The first VirtualHost section is used for requests without a known # server name. # <VirtualHost *:443> ProxyPass /software-suite http://localhost:8087/software-suite ProxyPassReverse /software-suite http://localhost:8087/software-suite SSLEngine on SSLCertificateFile /etc/apache2/ssl.crt/hostname.crt SSLCertificateKeyFile /etc/apache2/ssl.key/hostname.key </VirtualHost> <VirtualHost *:80> ProxyPass /software-suite http://localhost:8087/software-suite ProxyPassReverse /software-suite http://localhost:8087/software-suite </VirtualHost> 

When I run sudo service apache2 start, I get

* Starting web server apache2 Thu Feb 25 23:01:37 2016] [warn] module ssl_module is already loaded, skipping [Thu Feb 25 23:01:37 2016] [warn] The Alias directive in /etc/apache2/httpd.conf at line 499 will probably never match because it overlaps an earlier Alias. (98)Address already in use: make_sock: could not bind to address 0.0.0.0:443 no listening sockets available, shutting down Unable to open logs Action 'start' failed. The Apache error log may have more information. 

but when I run sudo netstat -ltnp | grep ':443' nothing is listening

Update

I moved the <VirtualHost *:443> node and its contents to /etc/apache2/sites-available/default-ssl. When I start apache2 I get

 * Starting web server apache2 [Fri Feb 26 16:36:43 2016] [warn] The Alias directive in /etc/apache2/httpd.conf at line 499 will probably never match because it overlaps an earlier Alias. [ OK ] 

and I can now access my website on port 80 but I get ERR_SSL_PROTOCOL_ERROR when I try to access it with https. Also when I execute sudo service apache2 status I get Apache2 is NOT running. even though it appears to be handling requests coming into port 80. I also commented out NameVirtualHost *:443, LoadModule ssl_module, and Listen 443 in httpd.conf. I don't see any errors in /var/log/apache2/error.log or /var/log/apache2/access.log, the only logs in /var/log/apache2

5
  • What version of apache do you have? execute apache2 -v. What version of ubuntu you have? execute lsb_release -a. Did you manually create the httpd.conf file? Commented Feb 25, 2016 at 23:56
  • Apache version is Apache/2.2.22 (Ubuntu). Ubuntu version is Ubuntu 12.04.5 LTS. I did not manually create the httpd.conf file Commented Feb 26, 2016 at 0:00
  • Try setting the configuration only in the SSL virtual hosts file (/etc/apache2/sites-available/default-ssl). Make a copy of the current httpd file and/or rename it. Give a try Commented Feb 26, 2016 at 0:11
  • NameVirtualHost is obsolete now, no so sure about 2.2.x; what happens when you comment out the two NameVirtualHost lines, and add a Listen 80 before the Listen 443 line? Commented Feb 26, 2016 at 13:46
  • I tried your suggestion @RuiFRibeiro with no luck. With your suggestion @tachomi I can access the website on port 80 but when I try https I get ERR_SSL_PROTOCOL_ERROR. I'll update the question Commented Feb 26, 2016 at 16:43

1 Answer 1

0

I found the answer here https://webmasters.stackexchange.com/questions/58650/what-steps-are-required-to-enable-ssl-on-apache2-with-ubuntu. I had to execute sudo a2ensite default-ssl and restart apache2.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.