ubuntuusers.de

nginx leitet immer auf https um

Status: Ungelöst | Ubuntu-Version: Ubuntu 17.04 (Zesty Zapus)
Antworten |

ManuelW77

Anmeldungsdatum:
27. Oktober 2013

Beiträge: Zähle...

Hallo zusammen,

ich habe nach einer Anleitung nginx und Nextcloud installiert. In der Grundeinstellung ist da von http (Port 80) eine Umleitung auf https (Port 443) konfiguriert.

Diese habe ich entfernt und versucht eigene Umleitungen zu erstellen, was jedoch nicht klappt. Ich werde weiterhin immer auf https umgeleitet. Einen restart von nginx habe ich nach der Änderung natürlich gemacht.

Hier mal die aktuelle config:

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
server {
        listen 80;
        server_name home.xxx.org 192.168.1.5 plex.local;
        ###return 302 https://$server_name$request_uri;  # enforce https
        location /plex {
                rewrite ^ http://127.0.0.1:32400/;
        }
}

server {
    listen              443 ssl;
    listen [::]:443; # IPv6
    server_name         home.xxx.org 192.168.1.5 plex.local;
#    ssl_certificate     /var/www/ssl/cloudssl.crt;
#    ssl_certificate_key /var/www/ssl/cloudssl.key;
    ssl_certificate     /etc/letsencrypt/live/home.xxx.org/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/home.xxx.org/privkey.pem;
    ssl_protocols       SSLv3 TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers         HIGH:!aNULL:!MD5;

    # Add headers to serve security related headers
    # Before enabling Strict-Transport-Security headers please read into this
    # topic first.
    #add_header Strict-Transport-Security "max-age=15768000;includeSubDomains;";
    add_header Strict-Transport-Security "max-age=15768000;";
    add_header X-Content-Type-Options nosniff;
    add_header X-Frame-Options "SAMEORIGIN";
    add_header X-XSS-Protection "1; mode=block";
    add_header X-Robots-Tag none;
    add_header X-Download-Options noopen;
    add_header X-Permitted-Cross-Domain-Policies none;

        # Path to the root of your installation
    root /var/www/cloud;
    index index.php;

    location = /robots.txt {
        allow all;
        log_not_found off;
        access_log off;
    }

    # The following 2 rules are only needed for the user_webfinger app.
    # Uncomment it if you're planning to use this app.
    rewrite ^/.well-known/host-meta /public.php?service=host-meta last;
    rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json last;

    location = /.well-known/carddav {
      return 301 $scheme://$host/remote.php/dav;
    }
    location = /.well-known/caldav {
      return 301 $scheme://$host/remote.php/dav;
    }

    # set max upload size
    client_max_body_size 512M;
    fastcgi_buffers 64 4K;

    # Disable gzip to avoid the removal of the ETag header
    gzip off;

    location / {
        rewrite ^ /index.php$uri;
    }

    location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)/ {
        deny all;
    }
    location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) {
        deny all;
    }

    location ~ ^/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|ocs-provider/.+|core/templates/40[34])\.php(?:$|/) {
        fastcgi_split_path_info ^(.+\.php)(/.*)$;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_param HTTPS on;
        #Avoid sending the security headers twice
        fastcgi_param modHeadersAvailable true;
        fastcgi_param front_controller_active true;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_intercept_errors on;
         #fastcgi_request_buffering off; #Available since nginx 1.7.11
    }

    location ~ ^/(?:updater|ocs-provider)(?:$|/) {
        try_files $uri/ =404;
        index index.php;
    }

   # Adding the cache control header for js and css files
    # Make sure it is BELOW the PHP block
    location ~* \.(?:css|js|woff|svg|gif)$ {
        try_files $uri /index.php$uri$is_args$args;
        add_header Cache-Control "public, max-age=7200";
        # Add headers to serve security related headers (It is intended to
        # have those duplicated to the ones above)
        # Before enabling Strict-Transport-Security headers please read into
        # this topic first.
        add_header Strict-Transport-Security "max-age=15768000;
          includeSubDomains;";

        add_header X-Content-Type-Options nosniff;
        add_header X-Frame-Options "SAMEORIGIN";
        add_header X-XSS-Protection "1; mode=block";
        add_header X-Robots-Tag none;
        add_header X-Download-Options noopen;
        add_header X-Permitted-Cross-Domain-Policies none;

        # Don't log access to assets
        access_log off;
    }

    location ~* \.(?:png|html|ttf|ico|jpg|jpeg)$ {
        try_files $uri /index.php$uri$is_args$args;

        # Don't log access to other assets
        access_log off;
    }

}

Wenn ich http://home.xxx.org/plex aufrufe, möchte ich dahin umgeleitet werden, komme aber immer wieder auf die https Seite also Nextcloud. Ich verstehe nicht, wieso immer noch die Umleitung gemacht wird.

Hoffe ihr könnt mir weiterhelfen.

Danke schon mal Manu

redknight Team-Icon

Moderator & Supporter
Avatar von redknight

Anmeldungsdatum:
30. Oktober 2008

Beiträge: 21823

Wohnort: Lorchhausen im schönen Rheingau

Zeile 25. Du hast hsts aktiviert. Zeile 21-23 weisen darauf hin, dass man das nur tun sollte, wenn man nachgelesen hat, was es macht.

Antworten |