How disable HTTPS for NGINX

I get config file for nginx from https://docs.nextcloud.com/server/15/admin_manual/installation/nginx.html
But if i edit file for http only it dosn’t work. Also i comment line overwrite.cli.url in config php

Remove these exact lines from your config and you should be good:

    # enforce https
    return 301 https://$server_name$request_uri;
}

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name cloud.example.com;

    # Use Mozilla's guidelines for SSL/TLS settings
    # https://mozilla.github.io/server-side-tls/ssl-config-generator/
    # NOTE: some settings below might be redundant
    ssl_certificate /etc/ssl/nginx/cloud.example.com.crt;
    ssl_certificate_key /etc/ssl/nginx/cloud.example.com.key;

    # 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; preload;";
    #
    # WARNING: Only add the preload option once you read about
    # the consequences in https://hstspreload.org/. This option
    # will add the domain to a hardcoded list that is shipped
    # in all major browsers and getting removed from this list
    # could take several months.
    add_header X-Content-Type-Options nosniff;
    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;
    add_header Referrer-Policy no-referrer;

That should give you a long block for the http part

server {
    listen 80;
    listen [::]:80;
    server_name cloud.example.com;
    ...
1 Like

I do this and still get return to https. Also i comment line overwrite.cli.url in config php

Did you restart nginx after the changes?

i do restart all, just in case))
systemctl restart mariadb php7-fpm redis nginx

1 Like

If you had 301 redirect, that’s “permanent”. So you need to delete browser cache or use another browser (or incognito mode) to test.

1 Like

This is the key. Make sure you comment out

}

server {

So you extend the first server block.