bitnami/phppgadmin: Gives Bad request. Nothing found in the error_log

363 Views Asked by At

I am using a docker-compose file for postgresql and phppgadmin as follows:

I have

  postgresql:
    image: "postgres:13-alpine"
    restart: always
    environment:
      POSTGRES_DB: project
      POSTGRES_USER: django
      POSTGRES_PASSWORD: django
      PGDATA: "/var/lib/postgresql/data/pgdata"
    networks:
      - postgresql_network

  phppgadmin:
    image: "bitnami/phppgadmin:7.13.0"
    environment:
      DATABASE_HOST: "postgresql"
      DATABASE_SSL_MODE: "disable"
    depends_on:
      - postgresql
    networks:
      - nginx_network
      - postgresql_network
    ports:
      - 80:8080

If I am running this on localhost, I can connect to the site. That is http://localhost and everything works well

But If I am on server say some ip address: xx.xx.xx.xx and try to connect http://xx.xx.xx.xx

then it says

Bad Request
Your browser sent a request that this server could not understand.
Additionally, a 400 Bad Request error was encountered while trying to use an ErrorDocument to handle the request.

I found the vhost as:

$ cat /opt/bitnami/apache/conf/bitnami/bitnami.conf
# Default Virtual Host configuration.

# Let Apache know we're behind a SSL reverse proxy
SetEnvIf X-Forwarded-Proto https HTTPS=on

<VirtualHost _default_:8080>
  DocumentRoot "/opt/bitnami/apache/htdocs"
  <Directory "/opt/bitnami/apache/htdocs">
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
  </Directory>

  # Error Documents
  ErrorDocument 503 /503.html
</VirtualHost>

Include "/opt/bitnami/apache/conf/bitnami/bitnami-ssl.conf"

and also the phppgadmin-vhost.conf

$ cat /opt/bitnami/apache/conf/vhosts/phppgadmin-vhost.conf 
<VirtualHost 127.0.0.1:8080 _default_:8080>
  ServerAlias *
  DocumentRoot /opt/bitnami/phppgadmin
  <Directory "/opt/bitnami/phppgadmin">
    Options -Indexes +FollowSymLinks -MultiViews
    AllowOverride All
    Require all granted
  </Directory>
</VirtualHost>

And i found the logs as:

$ ls -al /opt/bitnami/apache/logs
total 16
drwxrwxr-x 1 root root 4096 Aug 16 01:25 .
drwxrwxr-x 1 root root 4096 Aug 16 01:24 ..
lrwxrwxrwx 1 root root   11 Aug 16 01:25 access_log -> /dev/stdout
lrwxrwxrwx 1 root root   11 Aug 16 01:25 error_log -> /dev/stderr
drwxrwxr-x 1 root root 4096 Jan  1  1970 pagespeed_log

Here I dont see any errors in the error_log

And in my docker compose i see

phppgadmin_1  | 172.29.0.4 - - [17/Aug/2021:04:23:44 +0000] "GET / HTTP/1.0" 400 347
1

There are 1 best solutions below

6
Juan Ariza On

Bitnami Developer here

Are you accessing to the port 80 or the port 8080? Please note the container is listening in the port 8080 and it's possible you're not doing the port mapping in the remote server as you did locally using Docker Compose.

Could you add the environment variable PHPPGADMIN_ALLOW_REMOTE_CONNECTIONS=yes to the "phppgadmin" container in your docker-compose.yaml?

Finally, please also share the content of the vhost /opt/bitnami/apache/conf/vhosts/phppgadmin-vhost.conf if you're still struggling with it.