Fresh install on CentOS, Log In button does nothing

Hi all, I just set up a fresh instance of CentOS 7 with a LEMP (Nginx, MariaDB, PHP) stack. I followed the directions to create a database for the server and ran the setup-nextcloud.php file. When I try to log in for the first time, the login button just redirects me back to the login page. No error message or anything.

Nextcloud version: 17.0.2
Operating system and version: CentOS 7
Apache or nginx version: nginx/1.16.1
PHP version: PHP 7.3.13

The issue you are facing:

Is this the first time you’ve seen this error?: Y

Steps to replicate it:

  1. Set up a fresh install of CentOS 7
  2. Install and set up nginx, php, mariadb
  3. Disable SELinux
  4. Install the below config files
  5. Run the nextcloud-setup.php
  6. Try to log in for the first time

The output of your Nextcloud log in Admin > Logging:

I can’t access this, but here’s the output of the nextcloud.log file. I fixed the intl problem by installing php-intl so that’s no longer an issue.

{"reqId":"HhlJV93HzbGzzcWoONaF","level":3,"time":"2020-01-09T18:27:44+00:00","remoteAddr":"78.256.123.444","user":"--","app":"PHP","method":"GET","url":"\/cron.php","message":"You are using a fallback implementation of the intl extension. Installing the native one is highly recommended instead. at \/var\/www\/nextcloud\/3rdparty\/patchwork\/utf8\/src\/Patchwork\/Utf8\/Bootup\/intl.php#18","userAgent":"Mozilla\/5.0 (Windows NT 10.0; Win64; x64; rv:72.0) Gecko\/20100101 Firefox\/72.0","version":"16.0.3.0"}
{"reqId":"Wg22DfROmInjmyg6IFBD","level":3,"time":"2020-01-09T18:36:15+00:00","remoteAddr":"78.256.123.444","user":"--","app":"PHP","method":"POST","url":"\/login?redirect_url=\/apps\/files\/","message":"You are using a fallback implementation of the intl extension. Installing the native one is highly recommended instead. at \/var\/www\/nextcloud\/3rdparty\/patchwork\/utf8\/src\/Patchwork\/Utf8\/Bootup\/intl.php#18","userAgent":"Mozilla\/5.0 (Windows NT 10.0; Win64; x64; rv:72.0) Gecko\/20100101 Firefox\/72.0","version":"16.0.3.0"}
{"reqId":"tvSen6JPFCYxVa0P010P","level":3,"time":"2020-01-09T18:36:15+00:00","remoteAddr":"78.256.123.444","user":"--","app":"PHP","method":"GET","url":"\/apps\/files\/","message":"You are using a fallback implementation of the intl extension. Installing the native one is highly recommended instead. at \/var\/www\/nextcloud\/3rdparty\/patchwork\/utf8\/src\/Patchwork\/Utf8\/Bootup\/intl.php#18","userAgent":"Mozilla\/5.0 (Windows NT 10.0; Win64; x64; rv:72.0) Gecko\/20100101 Firefox\/72.0","version":"16.0.3.0"}
{"reqId":"1ha7qMIqwe1eGn2KGXoe","level":3,"time":"2020-01-09T18:36:15+00:00","remoteAddr":"78.256.123.444","user":"--","app":"PHP","method":"GET","url":"\/login?redirect_url=\/apps\/files\/","message":"You are using a fallback implementation of the intl extension. Installing the native one is highly recommended instead. at \/var\/www\/nextcloud\/3rdparty\/patchwork\/utf8\/src\/Patchwork\/Utf8\/Bootup\/intl.php#18","userAgent":"Mozilla\/5.0 (Windows NT 10.0; Win64; x64; rv:72.0) Gecko\/20100101 Firefox\/72.0","version":"16.0.3.0"}
{"reqId":"MulVXEl0KycQfGiboKjr","level":3,"time":"2020-01-09T18:36:16+00:00","remoteAddr":"78.256.123.444","user":"--","app":"PHP","method":"GET","url":"\/cron.php","message":"You are using a fallback implementation of the intl extension. Installing the native one is highly recommended instead. at \/var\/www\/nextcloud\/3rdparty\/patchwork\/utf8\/src\/Patchwork\/Utf8\/Bootup\/intl.php#18","userAgent":"Mozilla\/5.0 (Windows NT 10.0; Win64; x64; rv:72.0) Gecko\/20100101 Firefox\/72.0","version":"16.0.3.0"}

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

Note I replaced the actual site with mysite.com, but the URLs are correct.

<?php
$CONFIG = array (
  'instanceid' => '[REDACTED]',
  'passwordsalt' => '[REDACTED]',
  'secret' => '[REDACTED],
  'trusted_domains' =>
  array (
    0 => 'cloud.mysite.com',
  ),
  'datadirectory' => '/var/www/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '16.0.3.0',
  'overwrite.cli.url' => 'https://cloud.mysite.com',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'ncuser',
  'dbpassword' => '[REDACTED]',
  'installed' => true,
);

The output of your Apache/nginx/system log in /var/log/nginx/error.log:

These error messages are also old because I disabled selinux while trying to set it up.

2020/01/09 15:48:00 [alert] 26443#0: setrlimit(RLIMIT_NOFILE, 8192) failed (1: Operation not permitted)
2020/01/09 15:48:03 [error] 26443#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 78.256.123.444, server: cloud.mysite.com, request: "GET / HTTP/2.0", upstream: "fastcgi://127.0.0.1:9000", host: "cloud.mysite.com"
2020/01/09 15:48:03 [error] 26443#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 78.256.123.444, server: cloud.mysite.com, request: "GET /favicon.ico HTTP/2.0", upstream: "fastcgi://127.0.0.1:9000", host: "cloud.mysite.com"
2020/01/09 18:06:50 [error] 26443#0: *42 connect() failed (111: Connection refused) while connecting to upstream, client: 78.256.123.444, server: cloud.mysite.com, request: "GET / HTTP/2.0", upstream: "fastcgi://127.0.0.1:9000", host: "cloud.mysite.com"
2020/01/09 18:06:50 [error] 26443#0: *42 connect() failed (111: Connection refused) while connecting to upstream, client: 78.256.123.444, server: cloud.mysite.com, request: "GET /favicon.ico HTTP/2.0", upstream: "fastcgi://127.0.0.1:9000", host: "cloud.mysite.com"
2020/01/09 18:13:36 [alert] 27381#0: setrlimit(RLIMIT_NOFILE, 8192) failed (1: Operation not permitted)
2020/01/09 18:14:09 [alert] 27393#0: setrlimit(RLIMIT_NOFILE, 8192) failed (1: Operation not permitted)

Here is the bit that I think I probably messed up. The configs for nginx…

Here is the output for /etc/nginx/nginx.conf

user nginx;
worker_processes auto;
worker_rlimit_nofile 8192;
pid /run/nginx.pid;

events {
        worker_connections 8000;
        # multi_accept on;
}

http {

        ##
        # Basic Settings
        ##
        sendfile on;
        tcp_nopush on;
        tcp_nodelay on;
        keepalive_timeout 20s;
        types_hash_max_size 2048;
        client_max_body_size 10M;
        # server_tokens off;

        # server_names_hash_bucket_size 64;
        # server_name_in_redirect off;

        include /etc/nginx/mime.types;
        default_type application/octet-stream;

        ##
        # SSL Settings
        ##
        ssl_protocols TLSv1.2;
        ssl_ecdh_curve secp384r1;
        ssl_dhparam /etc/nginx/ssl/dhparam.pem;
        ssl_ciphers AES256+EECDH:AES256+EDH:!aNULL;
        ssl_prefer_server_ciphers on;
        ssl_stapling on;
        ssl_stapling_verify on;
        ssl_session_cache shared:SSL:30m;
        ssl_session_timeout 30m;
        resolver 8.8.4.4 8.8.8.8;

        ##
        # Logging Settings
        ##
        access_log /var/log/nginx/access.log;
        error_log /var/log/nginx/error.log;

        ##
        # Gzip Settings
        ##
        gzip on;
        gzip_disable "msie6";
        gzip_vary on;
        gzip_proxied any;
        gzip_comp_level 5;
        gzip_min_length 256;
        # gzip_buffers 16 8k;
        # gzip_http_version 1.1;
        gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;


        ##
        # Virtual Host Configs
        ##
        include /etc/nginx/conf.d/*.conf;
        include /etc/nginx/sites-enabled/*;
}

And the output for /etc/nginx/sites-enabled/nextcloud

upstream php-handler {
    server 127.0.0.1:9000;
    #server unix:/var/run/php/php7.2-fpm.sock;
}

server {
    listen 80;
    listen [::]:80;
    server_name cloud.mysite.com;
    # enforce https
    return 301 https://$server_name$request_uri;
}

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

    ssl_certificate /etc/letsencrypt/live/cloud.mysite.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/cloud.mysite.com/privkey.pem;
    ssl_trusted_certificate /etc/letsencrypt/live/cloud.mysite.com/chain.pem;

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

    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;

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

    # Path to the root of your installation
    root /var/www/nextcloud;

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

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

    # set max upload size
    client_max_body_size 512M;
    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;

    # Uncomment if your server is build with the ngx_pagespeed module
    # This module is currently not supported.
    #pagespeed off;

    location / {
        rewrite ^ /index.php;
    }

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

    location ~ ^\/(?:index|setup-nextcloud|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|oc[ms]-provider\/.+)\.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;
        # Avoid sending the security headers twice
        fastcgi_param modHeadersAvailable true;
        # Enable pretty urls
        fastcgi_param front_controller_active true;
        fastcgi_pass php-handler;
        fastcgi_intercept_errors on;
        fastcgi_request_buffering off;
    }

    location ~ ^\/(?:updater|oc[ms]-provider)(?:$|\/) {
        try_files $uri/ =404;
        index index.php;
    }

    # Adding the cache control header for js, css and map files
    # Make sure it is BELOW the PHP block
    location ~ \.(?:css|js|woff2?|svg|gif|map)$ {
        try_files $uri /index.php$request_uri;
        add_header Cache-Control "public, max-age=15778463";

        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;

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

    location ~ \.(?:png|html|ttf|ico|jpg|jpeg|bcmap)$ {
        try_files $uri /index.php$request_uri;
        # Optional: Don't log access to other assets
        access_log off;
    }
}

Below is a screenshot of the errors I’ve been getting with the content security policy / redirections.


Not sure if that would have anything to do with it

i don’t know about this.

if you need a quick way to setup a nextcloud server you may try my playbook:

this is not indented to heal your installation. run it only on a fresh centos installation.