OMV: HTTP redirect to HTTPS

  • This was not working???? You should not have to add what I told you with this in the code. And this is why you could not bind to 8080 with the omv-direct file idea I gave you. The above was bound to 8080.


    If you look at your whole server config file for the web gui you see the redirection coding is in there:



    Redirection should be working with this.

  • Put the check mark back in Force SSL. Then test this for redirection. You changed the web gui to 8080


    Code
    http://ipofyouromv:8080



    That should get redirected to:


    Code
    https://ipofyouromv:8443


    If not tell me what you get ??? Also, you might have to clear your browser cache. Your cache could be the problem.

  • It worked for me....


    Volker should have told us the web gui would put this redirection in there. It would have saved us a lot of time. I am not using ssl right now. I had to set that up and open ports on the firewall too.


    Glad you got it man!!!

  • With owncloud you will have to create a redirection file and add it to nginx. The instructions I gave for standard port should work for OC.


    Make file owncloud-redirect


    Try these contents:



    ****First show me the nginx server config file for owncloud that you are using. How did you install OC ???
    It will be in one of these locations:
    /etc/nginx/sites-enabled
    /etc/nginx/sites-available
    /etc/nginx/openmediavault-webgui.d


    Post that info and I look at this tomorrow. I am to bed......

  • I'm currently using Owncloud 8 and MySQL: alternative approach


    I found this guide for MariaDB, but I'm not sure this is the right method or not for MySQL: https://www.howtoforge.com/tut…-and-mariadb-on-centos-7/
    I noticing that half of the below codes are implemented in Nginx options via OMV webgui.



    OMV v5.0
    Asus Z97-A/3.1; i3-4370
    32GB RAM Corsair Vengeance Pro

    4 Mal editiert, zuletzt von tinh_x7 ()

  • If you look at the nginx server configuration file it already contains a redirect for owncloud...


    Code
    server {
            listen 80;
            server_name 192.168.1.101; #YourIP or domain
            return 301 https://$server_name$request_uri;  # redirect all to use ssl
    }


    If you put in:

    Code
    http://ipofyouromv


    it should be redirecting to https.
    You could try to alter this redirect a bit.


    Try this instead:

    Code
    listen [::]:80 default_server ipv6only=off;
        if ($scheme = http) {
            # Force redirection to HTTPS.
            return 301 https://$host$request_uri;
    }


    After changing you need to restart nginx:
    service nginx restart

  • FYI: The above codes aren't my configuration.
    My server is currently offline.


    If I create a owncloud-redirect file by using this previous step, and use the above code, OC redirective should work, right?:


    Code
    /etc/nginx/sites-enabled
    touch omv-redirect 
    chmod 644 omv-redirect
    chown root:root omv-redirect


    Code
    listen [::]:80 default_server ipv6only=off;
        if ($scheme = http) {
            # Force redirection to HTTPS.
            return 301 https://$host$request_uri;
    }

    OMV v5.0
    Asus Z97-A/3.1; i3-4370
    32GB RAM Corsair Vengeance Pro

    2 Mal editiert, zuletzt von tinh_x7 ()

  • No, this will not work. The code for the redirect is not correct for a single file. Compare it to my example on my 1st post on page 1. It would be best to include it in the main nginx server config file for owncloud.

  • Am I change file openmediavault-nginx in /etc/nginx/sites-available?
    Here's my OC config:



    OMV v5.0
    Asus Z97-A/3.1; i3-4370
    32GB RAM Corsair Vengeance Pro

    3 Mal editiert, zuletzt von tinh_x7 ()

  • After I changed openmediavault-nginx file, I got an error:


    Code
    Restarting nginx: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
    nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
    nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
    nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
    nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
    nginx: [emerg] still could not bind()
    nginx.


    Here's my new code:


    Edit: I got this error, if I'm using this code:

    Code
    server {
            listen 80;
            server_name 192.168.1.101; #YourIP or domain
            return 301 https://$server_name$request_uri;  # redirect all to use ssl
    }


    Error:

    Code
    sudo service nginx restart
    Restarting nginx: nginx: [emerg] "set" directive is not allowed here in /etc/nginx/sites-enabled/openmediavault-nginx:8
    nginx: configuration file /etc/nginx/nginx.conf test failed

    OMV v5.0
    Asus Z97-A/3.1; i3-4370
    32GB RAM Corsair Vengeance Pro

  • Check your nginx config before reload


    Code
    sudo nginx -t


    And you have an error in --> configuration file /etc/nginx/nginx.conf test failed


    Your hostname:


    Code
    hostname

    And see what you get


    You want to change you hostname if you are using a real domain name

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!