Core: 404 Not Found on login

Created on 14 Mar 2016  路  19Comments  路  Source: owncloud/core

Steps to reproduce

  1. one click install app on do
  2. download owncloud 9
  3. configure

    Expected behaviour

file list on login

Actual behaviour

404 not foudn on login

Server configuration

Operating system:
ubunut 14.04
Web server:
nginx
Database:
mariadb/mysql
PHP version:
5.5.9
ownCloud version: (see ownCloud admin page)

Updated from an older ownCloud or fresh install:
fresh install
Where did you install ownCloud from:
owncloud.org
Signing status (ownCloud 9.0 and above):

Login as admin user into your ownCloud and access 
http://example.com/index.php/settings/integrity/failed 
paste the results here.

List of activated apps:

If you have access to your command line run e.g.:
sudo -u www-data php occ app:list
from within your ownCloud installation folder

The content of config/config.php:

If you have access to your command line run e.g.:
sudo -u www-data php occ config:list system
from within your ownCloud installation folder

or 

Insert your config.php content here
(Without the database password, passwordsalt and secret)

<?php
$CONFIG = array (
  'instanceid' => 'ocrz9fcfgx7r',
  'passwordsalt' => '',
  'secret' => '',
  'trusted_domains' =>
  array (
    0 => 'domain',
  ),
  'datadirectory' => '/usr/share/nginx/html/owncloud/data',
  'overwrite.cli.url' => 'https://domain/owncloud',
  'dbtype' => 'mysql',
  'version' => '9.0.0.19',
  'dbname' => 'owncloud',
  'dbhost' => 'localhost',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'oc_USERNAME',
  'dbpassword' => '',
  'logtimezone' => 'UTC',
  'installed' => true,
);



**Are you using external storage, if yes which one:** local/smb/sftp/...

**Are you using encryption:** yes/no

**Are you using an external user-backend, if yes which one:** LDAP/ActiveDirectory/Webdav/...
no

With access to your command line run e.g.:
sudo -u www-data php occ ldap:show-config
from within your ownCloud installation folder

Without access to your command line download the data/owncloud.db to your local
computer or access your SQL server remotely and run the select query:
SELECT * FROM `oc_appconfig` WHERE `appid` = 'user_ldap';


Eventually replace sensitive data as the name/IP-address of your LDAP server or groups.

Client configuration

Browser:
chromium
Operating system:
arch linux

Logs

Web server error log

Insert your webserver log here

ownCloud log (data/owncloud.log)

Insert your ownCloud log here
{"reqId":"JDN7Z\/QjWqJ9CNLd2hb9","remoteAddr":"0.0.0.0","app":"PHP","message":"Undefined offset: 0 at \/usr\/share\/nginx\/html\/owncloud\/lib\/private\/setup\/mysql.php#46"$
{"reqId":"JDN7Z\/QjWqJ9CNLd2hb9","remoteAddr":"0.0.0.0","app":"no app in context","message":"Exception: {\"Exception\":\"DomainException\",\"Message\":\"Contacts tables are $
{"reqId":"JDN7Z\/QjWqJ9CNLd2hb9","remoteAddr":"0.0.0.0","app":"no app in context","message":"Exception: {\"Exception\":\"DomainException\",\"Message\":\"Calendar tables are $
{"reqId":"\/DzhPpG7otZUESVYuFIm","remoteAddr":"0.0.0.0","app":"core","message":"Login failed: 'username' (Remote IP: '0.0.0.0')","level":2,"time":"2016-03-13T17:50:41+$
{"reqId":"NybDPbv7fvssifRon0re","remoteAddr":"0.0.0.0","app":"core","message":"Login failed: 'username' (Remote IP: '0.0.0.0')","level":2,"time":"2016-03-14T11:03:01+0$

#### Browser log

Insert your browser log here, this could for example include:

a) The javascript console log
b) The network log
c) ...


Most helpful comment

I forgot: change location ~ \.php$ { to location ~ \.php(?:$|/) {
That should do the thing!

All 19 comments

except i'm using nginx

Did you try the proposed fix ?

CC @LukasReschke

rewrite base is already enabled in the .htaccess file, doesn't work for me

The .htaccess file isn't used by nginx. Please check/post your nginx server config.
(btw. fix 'overwrite.cli.url' => 'https://domain/owncloud', in config.php if thats your entry indeed)

user www-data;
worker_processes 4;
pid /run/nginx.pid;

events {
    worker_connections 768;
    # multi_accept on;
}

http {

    ##
    # Basic Settings
    ##

    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 65;
    types_hash_max_size 2048;
    # server_tokens off;

    # server_names_hash_bucket_size 64;
    # server_name_in_redirect off;

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

    ##
    # 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 6;
    # gzip_buffers 16 8k;
    # gzip_http_version 1.1;
    # gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;

    ##
    # nginx-naxsi config
    ##
    # Uncomment it if you installed nginx-naxsi
    ##

    #include /etc/nginx/naxsi_core.rules;

    ##
    # nginx-passenger config
    ##
    # Uncomment it if you installed nginx-passenger
    ##

    #passenger_root /usr;
    #passenger_ruby /usr/bin/ruby;

    ##
    # Virtual Host Configs
    ##

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
}


#mail {
#   # See sample authentication script at:
#   # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
# 
#   # auth_http localhost/auth.php;
#   # pop3_capabilities "TOP" "USER";
#   # imap_capabilities "IMAP4rev1" "UIDPLUS";
# 
#   server {
#       listen     localhost:110;
#       protocol   pop3;
#       proxy      on;
#   }
# 
#   server {
#       listen     localhost:143;
#       protocol   imap;
#       proxy      on;
#   }
#}

I was a bit imprecise...
That's not where the owncloud location block is located. Have a look in /etc/nginx/sites-enabled/.

server {

        listen 443 ssl;  

        server_name domain www.domain;

        ssl_certificate /etc/letsencrypt/live/domain/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/domain/privkey.pem;

        ssl_stapling on;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_prefer_server_ciphers on;
        ssl_ciphers ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA256:AES256-GCM-SHA384:AES256-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES256-CBC-SHA:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:!aNULL::!eNULL:HIGH:!MD5:!EDH:!EDE:!3DES:!RC4:!PSK:!EXPORT:!DES:!CAMELLIA128:!CAMELLIA256:!AES128:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-ECDSA-CHACHA20-POLY1305-RSA-AES256-SHA256:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:; 

        add_header Strict-Transport-Security "max-age=15768000; includeSubdomains";

        ssl_session_cache shared:SSL:50m;
        ssl_session_timeout 5m;
        #server_signature off;
        #server_tokens off;
        ssl_stapling_verify on;
        root /usr/share/nginx/html;
    index index.php index.html index.htm;

    # Make site accessible from http://localhost/

    location / {
        # First attempt to serve request as file, then
        # as directory, then fall back to displaying a 404.
        try_files $uri $uri/ =404;
        # Uncomment to enable naxsi on this location
        # include /etc/nginx/naxsi.rules
    }

    error_page 404 /404.html;
    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
        root /usr/share/nginx/html;
    }

    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
    }

        location ~ /.well-known {
                 allow all;
        }

}

server {
             listen 80;
             server_name domain;
             return 301 https://$host$request_uri;
}

Am I right, that you installed owncloud in a sub-path?

yes

/owncloud

Try adding under the line 麓fastcgi_split_path_info...麓:

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;

Don't forget to reload/restart nginx service.

I forgot: change location ~ \.php$ { to location ~ \.php(?:$|/) {
That should do the thing!

still getting the 404 message

If you fixed the location entry as described in https://github.com/owncloud/core/issues/23217#issuecomment-196914375 the 404 should be gone.
The 404 is delivered by nginx. Its definitely no PHP or owncloud issue!
Check the nginx error log and have a look at the installation manual. There are many other things missing in your config:
https://doc.owncloud.org/server/9.0/admin_manual/installation/nginx_configuration.html

That prooves that your nginx configuration is broken:
...unknown directive "ServerSignature"...
...SSL_do_handshake() failed...
...unexpected "m" in /etc/nginx/sites-enabled/default:28...

You have to fix the permissions, too:
...Unable to create file /usr/share/nginx/html/owncloud/config/config.php because Permission denied...

You should really have a look in the installation manual.

alright thank you

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings