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;
...
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
If you had 301 redirect, that’s “permanent”. So you need to delete browser cache or use another browser (or incognito mode) to test.
This is the key. Make sure you comment out
}
server {
So you extend the first server block.
Hi, I decided to post here because I spent days looking for a configuration that works for nginx only with http and all that I tested gave an error, even the suggestion that Schmu gave did not work.
So once again take the default nginx configuration from the nextcloud manual and comment out the following lines
# Prevent nginx HTTP Server Detection
server_tokens off;
# Enforce HTTPS
return 301 https://$server_name$request_uri;
#server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name cloud.example.com;
ssl_certificate /etc/ssl/nginx/cloud.example.com.crt;
ssl_certificate_key /etc/ssl/nginx/cloud.example.com.key;
server_tokens off;
# HSTS settings
# 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 Strict-Transport-Security "max-age=15768000; includeSubDomains; preload" always;
# The settings allows you to optimize the HTTP2 bandwitdth.
# See https://blog.cloudflare.com/delivering-http-2-upload-speed-improvements/
# for tunning hints
client_body_buffer_size 512k;
fastcgi_param HTTPS on;
After that I was able to access the nextcloud normally.
Pay attention because the configuration example that nextcloud provides for nginx is already configured for pretty urls