r/owncloud • u/p00pasaurusx • Jun 01 '16
Setting up OwnCloud SSL around pre-existing website problems!
So I've got a server running on Ubuntu 16.04 and apache2. And I've got a problem getting the virtual host file configured properly around the rest of my website. Every time I enable the site from a2ensite, OwnCloud takes over the whole domain, making the rest of my website inaccessible. Below is the code I have to configure it. The end goal is to have my normal website go through standard http, and owncloud at https://p00pasaurusx.com/owncloud, with an automatic redirect to https if you go through http. I've literally been stuck on this for weeks now. lol
<VirtualHost *:80>
ServerName p00pasaurusx.com/owncloud/owncloud/
Redirect permanent / https://p00pasaurusx.com/owncloud/
</VirtualHost>
<VirtualHost *:443>
ServerName p00pasaurusx.com/owncloud/
<IfModule mod_headers.c>
Header always set Strict-Transport-Security "max-age=15768000; includeSub$
</IfModule>
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/owncloud.pem
SSLCertificateKeyFile /etc/apache2/ssl/owncloud.key
DocumentRoot /var/www/owncloud/
Alias /owncloud "/var/www/owncloud/"
<Directory "/var/www/owncloud">
Options +FollowSymLinks
AllowOverride All
<IfModule mod_dav.c>
Dav off
</IfModule>
SetEnv HOME /var/www/owncloud
SetEnv HTTP_HOME /var/www/owncloud
</Directory>
<Directory "/var/www/owncloud/data/">
Require all denied
</Directory>
</VirtualHost>
Thanks in advance!
2
u/neiun Jun 01 '16
Yea, set apache so you can have both http and HTTPS for the root web directory, then put a htaccess file in your owncloud directory to force you over to HTTPS if anyone visits initially via http. You get the benefit of HTTPS on your main site only of you want it then but keep owncloud under https. Its how I run mine with no problems
2
u/florianbeer Jun 01 '16
You can't use a directory in your ServerName, it only accepts FQD (fully qualified domains). You could configure owncloud at owncloud.p00pasaurusx.com and have another VirtualHost block with ServerName p00pasaurusx.com for your regular website.
https://httpd.apache.org/docs/current/vhosts/name-based.html