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.

  • 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.



  • 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;
    }
  • Am I change file openmediavault-nginx in /etc/nginx/sites-available?
    Here's my OC config:



  • 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

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!