Hello, forgive my bad English, it is not my first language.
I don’t know if anyone else has faced the problem I have but I at least wanted to ask.
You see, I installed Nextcloud in a docker container and used nginx reverse proxy with the software Cloud Panel to be able to access it from the Internet. Everything worked well.
But I noticed once I started using Nextcloud that the “Security” section was throwing me warning messages. Specifically, I am concerned about these two messages:
The reverse proxy header configuration is incorrect. This is a security issue and can allow an attacker to spoof their IP address as visible to the Nextcloud. For more details see the documentation
.
Accessing site insecurely via HTTP. You are strongly advised to set up your server to require HTTPS instead. Without it some important web functionality like “copy to clipboard” or “service workers” will not work! For more details see the documentation
.
I think this is something to do with Nginx and the specific configuration it has with Cloud Panel. This would be the conf:
server {
listen 80;
listen [::]:80;
listen 443 quic;
listen 443 ssl;
listen [::]:443 quic;
listen [::]:443 ssl;
http2 on;
http3 off;
{{ssl_certificate_key}}
{{ssl_certificate}}
server_name nextcloud.ouroboroslabs.eu;
{{root}}
{{nginx_access_log}}
{{nginx_error_log}}
if ($scheme != "https") {
rewrite ^ https://$host$request_uri permanent;
}
location @reverse_proxy {
proxy_pass {{reverse_proxy_url}};
proxy_http_version 1.1;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_pass_request_headers on;
proxy_max_temp_file_size 0;
proxy_connect_timeout 900;
proxy_send_timeout 900;
proxy_read_timeout 900;
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
proxy_temp_file_write_size 256k;
}
{{settings}}
include /etc/nginx/global_settings;
add_header Cache-Control no-transform;
index index.html;
location ^~ /.well-known {
auth_basic off;
allow all;
try_files $uri @reverse_proxy;
}
location / {
try_files $uri @reverse_proxy;
}
}
I would have to modify or add something there, right?
But I have no idea what it could be.
The docker compose:
volumes:
nextcloud:
db:
services:
db:
image: mariadb:10.11
restart: always
command: --transaction-isolation=READ-COMMITTED --log-bin=binlog --binlog-format=ROW
volumes:
- /srv/dev-disk-by-uuid-3f6dc867-2449-4511-a9a0-695590711524/Docker_datos/db:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=XXXXXXXX
- MYSQL_PASSWORD=XXXXXXXX
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
app:
image: nextcloud
restart: always
ports:
- 6872:80
links:
- db
volumes:
- /srv/dev-disk-by-uuid-3f6dc867-2449-4511-a9a0-695590711524/Docker_datos/nextcloud:/var/www/html
environment:
- MYSQL_PASSWORD=XXXXXXXX
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
- MYSQL_HOST=db
- TZ=Europe/Madrid
The “occ config:list system” result (man, achieving this was difficult for me.):
{
"system": {
"htaccess.RewriteBase": "\/",
"memcache.local": "\\OC\\Memcache\\APCu",
"apps_paths": [
{
"path": "\/var\/www\/html\/apps",
"url": "\/apps",
"writable": false
},
{
"path": "\/var\/www\/html\/custom_apps",
"url": "\/custom_apps",
"writable": true
}
],
"upgrade.disable-web": true,
"instanceid": "***REMOVED SENSITIVE VALUE***",
"passwordsalt": "***REMOVED SENSITIVE VALUE***",
"secret": "***REMOVED SENSITIVE VALUE***",
"trusted_domains": [
"nextcloud.ouroboroslabs.eu"
],
"datadirectory": "***REMOVED SENSITIVE VALUE***",
"dbtype": "mysql",
"version": "29.0.3.4",
"overwrite.cli.url": "http:\/\/nextcloud.ouroboroslabs.eu",
"dbname": "***REMOVED SENSITIVE VALUE***",
"dbhost": "***REMOVED SENSITIVE VALUE***",
"dbport": "",
"dbtableprefix": "oc_",
"mysql.utf8mb4": true,
"dbuser": "***REMOVED SENSITIVE VALUE***",
"dbpassword": "***REMOVED SENSITIVE VALUE***",
"installed": true
}
}
Nextcloud version: 29.0.3
PHP version : 8.2.21
Nginx version: 1.26.1