TimWolla / docker-adminer

Database management in a single PHP file
https://hub.docker.com/_/adminer/
157 stars 69 forks source link

Theme error NGINX FastCGI #64

Closed ghost closed 4 years ago

ghost commented 4 years ago

I'm having a problem setting the theme with NGINX and FastCGI... Adminer works totally fine, but adminer.css is not loading at all.

Here is my docker compose

version: "3.7"

services:
  service-postgresql:
    container_name: container-postgresql
    image: postgres:latest
    ports:
      - "5432:5432"
    environment:
      - POSTGRES_PASSWORD=my-pass
      - POSTGRES_USER=my-user
      - POSTGRES_DB=my-db

service-adminer:
    container_name: container-adminer
    image: adminer:fastcgi
    depends_on:
      - service-postgresql
    environment:
      - ADMINER_DEFAULT_SERVER=service-postgresql
      - ADMINER_DESIGN=galkaev

service-nginx:
    container_name: container-nginx
    image: nginx
    depends_on:
      - service-adminer
    ports:
      - "80:80"
    volumes:
      - /my/path/conf.d:/etc/nginx/conf.d:ro

And here is my nginx server conf

server {
    listen       80;
    server_name  localhost;

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

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

    location / {
        # This is cool because no php is touched for static content.
        # include the "?$args" part so non-default permalinks doesn't break when using query string
        try_files $uri $uri/ /index.php?$args;
    }

    location ~ \.php$ {
        #NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
        include fastcgi_params;
        fastcgi_intercept_errors on;
        fastcgi_param  SCRIPT_FILENAME /var/www/html/index.php;
        fastcgi_pass service-adminer:9000;
    }

    location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
        expires max;
        log_not_found off;
    }
}

Somebody can point me what I'm doing wrong?

Many thanks in advance.

TimWolla commented 4 years ago

You need to pass all requests to PHP, not just requests for files ending in .php. See: https://github.com/TimWolla/docker-adminer/issues/14#issuecomment-385508119

ghost commented 4 years ago

You need to pass all requests to PHP, not just requests for files ending in .php. See: #14 (comment)

Thanks!

Now it's working fine.