0

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
Santhosh
  • 9,965
  • 20
  • 103
  • 243

1 Answers1

0

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.

Juan Ariza
  • 1,038
  • 5
  • 10
  • I am using `8080` only – Santhosh Aug 18 '21 at 07:09
  • `PHPPGADMIN_ALLOW_REMOTE_CONNECTIONS=yes` - What is this for. Because when i use it on localhost it works well. I am connecting to a remote postgresql server only – Santhosh Aug 18 '21 at 07:10
  • So you're actually connecting to http://xx.xx.xx.xx:8080, am I right? The `PHPPGADMIN_ALLOW_REMOTE_CONNECTIONS` is necessary to add the Apache directive `Require all granted` to the associated virtual host. – Juan Ariza Aug 18 '21 at 08:45
  • I am connecting to 8080. also updated the question with `phppgadmin-vhost.conf` – Santhosh Aug 18 '21 at 17:30
  • Also how to check whats the error or logs. I am clueless – Santhosh Aug 18 '21 at 17:31
  • Can you reproduced the issue when using a simple `curl`? Sth like: `curl http://xx.xx.xx.xx:8080/` Please also double-check you're using `http://` instead of `https://` – Juan Ariza Aug 19 '21 at 06:31