Can't start Apache 2 - Probably faulty SSL configuration

1

I followed this german tutorial to set up a Raspberry 2 Owncloud Server (connect.de/ratgeber/so-installieren-sie-owncloud-auf-einem-raspberry-pi-1540246.html) everything worked fine without any Errors until ...

enter image description here

If I try to start the apache server with "sudo service apache2 start" but

[....] Starting web server: apache2apache2: Syntax error on line 268 of /etc/apache2/apache2.conf: Syntax error on line 1 of /etc/apache2/sites-enabled/ssl: /etc/apache2/sites-enabled/ssl:1: <virtualhost> was not closed.
Action 'start' failed.
The Apache error log may have more information.
 failed!

Here are the 2 files in questions

/etc/apache2/apache2.conf

line 268 : Include sites-enabled/

whole file http://pastebin.com/MrUY0Pu3

etc/apache2/sites-enabled/ssl

<virtualhost *:443> SSLEngine On SSLCertificateFile /etc/apache2/ssl/apache.pem DocumentRoot /var/www </virtualhost>

Before I messed arround with SSL the server worked fine.

Any help is highly appreciated.

Addendum: I used these commands to create a certificate:

sudo mkdir -p /etc/apache2/ssl
sudo openssl req -new -x509 -days 365 -nodes -out /etc/apache2/ssl/apache.pem -keyout /etc/apache2/ssl/apache.pem
sudo ln -sf /etc/apache2/ssl/apache.pem /etc/apache2/ssl/`/usr/bin/openssl x509 -noout -hash < /etc/apache2/ssl/apache.pem`
sudo chmod 600 /etc/apache2/ssl/apache.pem

When asked for common name I used my dyn-dns

Then I replaced everything in /etc/apache2/ports.conf with this:

Listen 192.168.178.33:80 <IfModule mod_ssl.c> Listen 443 </IfModule>

Then I'd have to restart Apache with

sudo service apache2 reload

but this allready failed with the error message stated above.

Im quiet sure it was stupid, but I continued with the tutorial anyway. If wanted I can include the commands but they're allready in the picture as well as in the tutorial.

As a sidenote: Im pretty sure I f*cked up the apache2.conf. I only added ServerName my-dyndns.de and It hangs itself up just a line above that.

PrivatTier

Posted 2015-12-02T16:46:09.787

Reputation: 11

The console indicates a file, with instructions on how to create the certificate properly, did you follow those instructions? – Ramhound – 2015-12-02T17:04:48.453

Yes, I followed the above mentioned and linked tutorial closely. These commandes where given to create a certificate.

sudo mkdir -p /etc/apache2/ssl

sudo openssl req -new -x509 -days 365 -nodes -out /etc/apache2/ssl/apache.pem -keyout /etc/apache2/ssl/apache.pem

sudo ln -sf /etc/apache2/ssl/apache.pem /etc/apache2/ssl//usr/bin/openssl x509 -noout -hash < /etc/apache2/ssl/apache.pem

sudo chmod 600 /etc/apache2/ssl/apache.pem I repeatet these as a first attempt of fixing since I could not find a tutorial on how to delte a created certificate. – PrivatTier – 2015-12-02T18:19:57.283

Im sorry, Im not used to formating here. I'll include the used commands in the original post – PrivatTier – 2015-12-02T18:30:23.840

Does your /etc/apache2/sites-enabled/ssl file really contain no line breaks? Try adding new lines between directives. – chrishiestand – 2015-12-05T05:43:01.263

No answers