[SOLVED] Neos installation nginx

Hey guys,

I have build a docker container with nginx. If I start the setup and type in the setup password I get a database error:
Database Error
Sorry, we detected an error with your database. Check your log files in Data/Logs/* for more information.
#0: An error occurred in the Database Abstraction Layer.
You might want to configure or check your database configuration in the setup.

My nginx server config:
server {
listen 80 default_server;
listen [::]:80 default_server;

    root /var/www/html/Neos/Web;

    index index.php;

    server_name _;

    location / {
    try_files $uri $uri/ /index.php?$args;
    }

    location ~ /\. {
        deny all;
        access_log off;
        log_not_found off;
    }

    location = /favicon.ico {
        log_not_found off;
        access_log off;
    }

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

    location /_Resources/ {
        access_log off;
        log_not_found off;
        expires max;
        break;
    }

    fastcgi_param   FLOW_CONTEXT      Development;
    fastcgi_param   FLOW_REWRITEURLS  1;

    location ~ \.php$ {
           include snippets/fastcgi-php.conf;

           # With php5-cgi alone:
           fastcgi_pass 127.0.0.1:9000;
           # With php5-fpm:
           #fastcgi_pass unix:/var/run/php5-fpm.sock;
    }

}

Hi Patrick,

This has nothing to do with nginx, but is a standard Flow/Doctrine error. Check your logs, most probably it’s due to missing tables or missing migrations.

Hey,

Thank you for your answer, but I have no database configured yet. It is just the first setup routine.

Hi

I have exactly the same issue. As i can see in the logs, neos somehow tries to access the database BEFORE even entering any details. In the exceptions, i see this query, but grepping recursive for the string “n0_” does only show exception results.

SELECT n0_.persistence_object_identifier AS persis…active = ? ORDER BY n0_.site ASC, n0_.hostname ASC", array|1|, array|1|, NULL

WHY does it tries to access the db before setup and what can i do about it?

Look at the Settings.yaml.example here: https://goo.gl/RDqpnK
Copy the content in your Settings.yaml in the Configuration/ Folder. Has worked in my case …

If it does not work, try to flush the privileges in mysql.

Just tried the setup without any credentials and couldn’t reproduce the error.

It looks like it’s trying to find a domain, which it only does in the frontend/backend, but not the setup.

Are you sure you’re running the setup? (/setup) where you login with a one time password? Asking since it looks like you haven’t initiated the database and tables and you’d probably get such an error in the frontend if you haven’t run the setup to initiate the database.

After a lot debugging and trial and error i found the issue:

When running with php-fpm you need to specify FLOW_CONTEXT inside the “php-location”.
For example this will result in the described error (removed unrelevant parts):

server {
  [..]

	fastcgi_param   FLOW_CONTEXT      Production;
	fastcgi_param   FLOW_REWRITEURLS  1;

	location ~ \.php$ {
        try_files $uri =404;
		fastcgi_split_path_info ^(.+\.php)(/.+)$;
		fastcgi_pass unix:/var/run/php-fpm.sock;
		fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param SCRIPT_NAME $fastcgi_script_name;
		fastcgi_index index.php;
		include fastcgi_params;
	}
  
  [..]

}

While this configuration works perfectly:

server {
  [..]


	location ~ \.php$ {
    try_files $uri =404;
		fastcgi_split_path_info ^(.+\.php)(/.+)$;
		fastcgi_pass unix:/var/run/php-fpm.sock;
	    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param SCRIPT_NAME $fastcgi_script_name;

        fastcgi_param   FLOW_CONTEXT      Production;
	    fastcgi_param   FLOW_REWRITEURLS  1;
    
	    fastcgi_index index.php;
		include fastcgi_params;
	}
  
  [..]

}
3 Likes

Thank you @eni23 for posting your solution. The same error cost me hours to get my docker setup running.