How To
- Buat file
docker-compose.yml
services:
pgadmin4:
container_name: pgadmin4-ctr
image: dpage/pgadmin4:latest
restart: always
logging:
driver: none
ports:
- "666:80"
environment:
- 'PGADMIN_DEFAULT_EMAIL=ipang@ipang.my.id'
- 'PGADMIN_DEFAULT_PASSWORD=fufufafaBNGST!'
- 'PGADMIN_CONFIG_ENHANCED_COOKIE_PROTECTION=True'
- 'PGADMIN_CONFIG_LOGIN_BANNER="Authorised users only!"'
- 'PGADMIN_CONFIG_CONSOLE_LOG_LEVEL=10'
networks:
- "postgres-net"
networks:
postgres-net:
name: postgres-net
-
Run dengan
docker-compose up -d
-
Untuk setup reverse proxy di nginx tanpa subpath
location /pgadmin/ {
auth_basic "Halo kakak";
auth_basic_user_file /etc/nginx/.pgadmin-user-list;
add_header X-Robots-Tag "noindex, nofollow, nosnippet, noarchive";
add_header Strict-Transport-Security "max-age=31536000; includeSubdomains; preload";
add_header X-XSS-Protection "1; mode=block";
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options nosniff;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Scheme $scheme;
proxy_set_header Host $host;
proxy_pass http://localhost:666/;
proxy_redirect off;
proxy_read_timeout 5m; # Reducing this
proxy_send_timeout 5m;
proxy_connect_timeout 5m; # Adding this
}
- Setup nginx dengan subpath
location /pgadmin/ {
auth_basic "Halo kakak";
auth_basic_user_file /etc/nginx/.pgadmin-user-list;
add_header X-Robots-Tag "noindex, nofollow, nosnippet, noarchive";
add_header Strict-Transport-Security "max-age=31536000; includeSubdomains; preload";
add_header X-XSS-Protection "1; mode=block";
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options nosniff;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
##to serve with subpath add this line
proxy_set_header X-Script-Name /pgadmin;
proxy_set_header X-Scheme $scheme;
proxy_set_header Host $host;
proxy_pass http://localhost:666/;
proxy_redirect off;
proxy_read_timeout 5m; # Reducing this
proxy_send_timeout 5m;
proxy_connect_timeout 5m; # Adding this
}