Apache 2.4 Owncloud redirect

Discussion in 'Apache' started by Paul Newbery, Apr 13, 2019.

  1. #1
    Hi all,
    I'm new here, so please be gentle with me! (Previously posted in Apachelounge)
    I am running an ownCloud 10.x server on a Linux Mint PC with Apache 2.4. Due to a change in network infrastructure, access to the server has had to change. The server is now in a DMZ on a router to which I have no administrative access. Port forwarding has been set up with 8080 going to port 80 and 40440 going to port 443. External access with the ownCloud client using port 40440 is working fine, but internally, it does not work. I have opened port 40440 on the server firewall and attempted to use a VirtualHost entry in the owncloud.conf in etc/apache2/sites-available, to forward port 40440 to https on 443 but cannot get it to work.
    When an attempt is made to access the server using the external URL internally:
    htt ps://harry.mydomain.org.uk:40440/owncloud,
    an error box is presented with the option to "use a different URL", "Retry Unencrypted using HTTP (Insecure)" [this works] or "Configure client-side TLS certificate". Cancelling out gives: "Failed to connect to ownCloud at
    htt ps://blah.blah. SSL handshake failed"
    Here's where I hope you guys will come in and save the day.
    These are the entries in owncloud.conf:

    
    <VirtualHost *:80>
    Alias /owncloud "/var/www/owncloud/"
    ServerName harry.mydomain.org.uk
    DocumentRoot /var/www/owncloud
    Redirect permanent / https:/harry.mydomain.org.uk
    </VirtualHost>
    
    listen *:40440
    <VirtualHost *:40440>
    Alias /owncloud "/var/www/owncloud/"
    ServerName harry.mydomain.org.uk
    DocumentRoot /var/www/owncloud
    Redirect permanent / https://harry.mydomain.org.uk/
    </VirtualHost>
    
    <VirtualHost _default_:443>
    Alias /owncloud "/var/www/owncloud/"
    ServerName harry.mydomain.org.uk
    DocumentRoot /var/www/owncloud
    
    <IfModule mod_headers.c>
    Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains"
    </IfModule>
    
    <IfModule mod_dav.c>
    Dav off
    </IfModule>
    
    SetEnv HOME /var/www/owncloud
    SetEnv HTTP_HOME /var/www/owncloud
    
    SSLEngine on
    SSLCertificateFile /etc/apache2/ssl/owncloud.pem
    SSLCertificateKeyFile /etc/apache2/ssl/owncloud.key
    
    Code (markup):
    I have tried:
    Removing the redirect from port 40440 and adding the SSL statements to that VirtualHost *:40440 section. No Joy
    Adding https protocol to the listen statement thus: listen *:40440 https
    No joy

    Any help will be much appreciated.
    Regards
    Paul N.
     
    Paul Newbery, Apr 13, 2019 IP
  2. Paul Newbery

    Paul Newbery Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #2
    Well, it turns out that if you modify the correct .conf file, i.e. the one in /sites-enabled, the suggestion I was given of removing the port 40440 redirect and adding the port 443 SSL statements and other bits into the 40440 VirtualHost, works perfectly! I read in another forum, that you should only modify a sites .conf file in the /sites-available directory, but that's where I was going wrong.
    Sorry to have troubled you all!
    Paul N.
     
    Paul Newbery, Apr 14, 2019 IP