LINUX.ORG.RU
решено ФорумAdmin

Nextcloud и nginx-proxy не работает вход через клиента

 


0

1

На гипервизоре поднята ВМ с ubuntu-server через snap установлен nextcloud. Web-морда работает замечательно, но клиенты nextcloud ни на компе ни на телефоне не могут подключиться. При добавлении новой учетной записи в клиенте, указываю путь до адреса сервера https://cloud.XXXXXX.ru, далее перебрасывает в браузер – Вход в систему. Прохожу авторизацию, после чего предлагает разрешить доступ к аккаунту, но после нажатия кнопки “Разрешить доступ” ничего не происходит.

server {
    listen 80;
    server_name cloud.XXXX.XX;
    include acme.conf;
    location / {
    return 301 https://cloud.XXXX.XX$request_uri;
    add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;";
    }
}

server {
    listen 443 ssl;
    server_name cloud.XXXX.XX;
    include acme.conf;

    client_max_body_size 0;
    underscores_in_headers on;

    ssl on;
    ssl_certificate /etc/letsencrypt/live/cloud.XXXX.XX/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/cloud.XXXX.XX/privkey.pem;


    location / {
            proxy_set_header Upgrade $http_upgrade;
            proxy_headers_hash_max_size 512;
            proxy_headers_hash_bucket_size 64;
            proxy_set_header Host $host;
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            add_header Front-End-Https on;
            proxy_pass http://192.168.133.14;
    }


но после нажатия кнопки “Разрешить доступ” ничего не происходит

значит кнопку не нажимали.

логи нжинкса? клауда? консоль разработчика в браузере?

deep-purple ★★★★★
()
Ответ на: комментарий от Shulman

на форуме денвера тоже есть конфиг для мускуля с пустым паролем рута.

deep-purple ★★★★★
()
Ответ на: комментарий от deep-purple

nginx гипервизор:

2021/02/26 12:08:30 [error] 13918#13918: *513424 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 178.49.58.237, server: cloud.XXXX.XX, request: "GET /index.php/csrftoken HTTP/1.1", upstream: "http://192.168.133.14:80/index.php/csrftoken", host: "cloud.XXXX.XX"
2021/02/26 12:08:31 [error] 13918#13918: *513426 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 178.49.XX.XXX, server: cloud.XXXX.XX, request: "GET /ocs/v2.php/apps/notifications/api/v2/notifications HTTP/1.1", upstream: "http://192.168.133.14:80/ocs/v2.php/apps/notifications/api/v2/notifications", host: "cloud.XXXX.XX"
2021/02/26 12:08:31 [error] 13918#13918: *513428 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 178.49.58.237, server: cloud.XXXX.XX, request: "PUT /index.php/apps/user_status/heartbeat HTTP/1.1", upstream: "http://192.168.133.14:80/index.php/apps/user_status/heartbeat", host: "cloud.XXXX.XX"


ВМ nextcloud:
sudo snap logs nextcloud
2021-02-26T07:56:33Z nextcloud.apache[115145]: System config value redis => host set to string /tmp/sockets/redis.sock
2021-02-26T07:56:34Z nextcloud.apache[115214]: System config value redis => port set to integer 0
2021-02-26T07:56:34Z nextcloud.apache[115282]: System config value memcache.locking set to string \OC\Memcache\Redis
2021-02-26T07:56:35Z nextcloud.apache[115351]: System config value memcache.local set to string \OC\Memcache\Redis
2021-02-26T07:56:35Z nextcloud.apache[115419]: No such app enabled: updatenotification
2021-02-26T07:56:36Z nextcloud.apache[115034]: Making sure nextcloud is fully upgraded...
2021-02-26T07:56:36Z nextcloud.apache[115558]: Nextcloud is already latest version
2021-02-26T07:56:36Z nextcloud.apache[114999]: All set! Running httpd...
2021-02-26T07:56:36Z nextcloud.apache[115565]: No certificates are active: using HTTP only
2021-02-26T07:56:36Z nextcloud.apache[115604]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
Dmit84
() автор топика
Последнее исправление: Dmit84 (всего исправлений: 1)
Ответ на: комментарий от Dmit84

без проксирования через нжинкс работает?

где логи нжинкса?

не всякий мусор вне контекста, а логи в моменты запросов.

deep-purple ★★★★★
()
Ответ на: комментарий от deep-purple

Без проксирования внутри локальной сети при подключение клиента по локальному адресу все работает. Но необходимо запустить извне по доменому через проксирование nginx

Dmit84
() автор топика
Ответ на: комментарий от deep-purple
94.130.x - - [26/Feb/2021:16:05:47 +0700] "POST /index.php/login/v2/poll HTTP/1.1" 400 249 "-" "Mozilla/5.0 (Windows) mirall/3.1.3stable-Win64 (build 20210218) (Nextcloud)"
94.130.x - - [26/Feb/2021:16:05:54 +0700] "GET /ocs/v2.php/apps/notifications/api/v2/notifications HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:85.0) Gecko/20100101 Firefox/85.0"
Dmit84
() автор топика
Ответ на: комментарий от Dmit84

upstream php-handler {

server 127.0.0.1:9000;

server unix:/var/run/php/php7.4-fpm.sock;

}

server { listen 80; listen [::]:80; server_name some.domain.ru;

# Enforce HTTPS
return 301 https://$server_name$request_uri;

}

server{ #имя сервера: server_name some.domain.ru;

listen 80;

listen 443 ssl;
ssl_certificate /etc/letsencrypt/live/some.domain.ru/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/some.domain.ru/privkey.pem;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers "ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS:!AES256";
ssl_prefer_server_ciphers on;
ssl_dhparam /etc/nginx/ssl/dhp-4096.pem;

#логи
access_log /var/log/nginx/some.domain.ru.access.log;
error_log  /var/log/nginx/some.domain.ru.error.log;


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

# Enable gzip but do not remove ETag headers
gzip on;
gzip_vary on;
gzip_comp_level 4;
gzip_min_length 256;
gzip_proxied expired no-cache no-store private no_last_modified no_etag auth;
gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy;

# Pagespeed is not supported by Nextcloud, so if your server is built
# with the `ngx_pagespeed` module, uncomment this line to disable it.
#pagespeed off;

add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;" always;

# HTTP response headers borrowed from Nextcloud `.htaccess`
add_header Referrer-Policy                      "no-referrer"   always;
add_header X-Content-Type-Options               "nosniff"       always;
add_header X-Download-Options                   "noopen"        always;
add_header X-Frame-Options                      "SAMEORIGIN"    always;
add_header X-Permitted-Cross-Domain-Policies    "none"          always;
add_header X-Robots-Tag                         "none"          always;
add_header X-XSS-Protection                     "1; mode=block" always;

# Remove X-Powered-By, which is an information leak
fastcgi_hide_header X-Powered-By;

# корневая директория
root /var/www/some.domain.ru/;

index index.php index.html /index.php$request_uri;

# Default Cache-Control policy
expires 1m;

# Rule borrowed from `.htaccess` to handle Microsoft DAV clients
location = / {
    if ( $http_user_agent ~ ^DavClnt ) {
        return 302 /remote.php/webdav/$is_args$args;
    }
}

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

# Make a regex exception for `/.well-known` so that clients can still
# access it despite the existence of the regex rule
# `location ~ /(\.|autotest|...)` which would otherwise handle requests
# for `/.well-known`.
location ^~ /.well-known {
    # The following 6 rules are borrowed from `.htaccess`

    location = /.well-known/carddav     { return 301 /remote.php/dav/; }
    location = /.well-known/caldav      { return 301 /remote.php/dav/; }
    # Anything else is dynamically handled by Nextcloud
    location ^~ /.well-known            { return 301 /index.php$uri; }

    try_files $uri $uri/ =404;
}

# Rules borrowed from `.htaccess` to hide certain paths from clients
location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)(?:$|/)  { return 404; }
location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console)              { return 404; }

# Ensure this block, which passes PHP files to the PHP process, is above the blocks
# which handle static assets (as seen below). If this block is not declared first,
# then Nginx will encounter an infinite rewriting loop when it prepends `/index.php`
# to the URI, resulting in a HTTP 500 error response.
location ~ \.php(?:$|/) {
    fastcgi_split_path_info ^(.+?\.php)(/.*)$;
    set $path_info $fastcgi_path_info;

    try_files $fastcgi_script_name =404;

    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param PATH_INFO $path_info;
    fastcgi_param HTTPS on;

    fastcgi_param modHeadersAvailable true;         # Avoid sending the security headers twice
    fastcgi_param front_controller_active true;     # Enable pretty urls
    fastcgi_pass php-handler;

    fastcgi_intercept_errors on;
    fastcgi_request_buffering off;
}

location ~ \.(?:css|js|svg|gif)$ {
    try_files $uri /index.php$request_uri;
    expires 6M;         # Cache-Control policy borrowed from `.htaccess`
    access_log off;     # Optional: Don't log access to assets
}

location ~ \.woff2?$ {
    try_files $uri /index.php$request_uri;
    expires 7d;         # Cache-Control policy borrowed from `.htaccess`
    access_log off;     # Optional: Don't log access to assets
}

location / {
    try_files $uri $uri/ /index.php$request_uri;
}
Shulman
()
Ответ на: комментарий от Shulman

локально все работает. Затык в проксирование

Dmit84
() автор топика
Ответ на: комментарий от Dmit84

Меня, наверное, бы вот это посмущало бы:

/index.php/login/v2/poll
Выглядит так, словно должно было просто /login/v2/poll, но зачем-то в $request_uri приляпался index.php спереди.

Пардон, мимо проходил )

Toxo2 ★★★
()

Все спасибо проблему нашел. В /var/snap/nextcloud/current/nexcloud/config/config.php добавил:

'overwriteprotocol' => 'https',

Dmit84
() автор топика
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.