Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
VGSources
Blog

How to Install and Configure pgAdmin 4 in Server Mode

Install pgAdmin 4 as a secure multi-user web service. This guide covers host and container deployments, first-run superuser setup, Gunicorn and reverse-proxy configuration, URL-prefix handling, persistence, TLS, and troubleshooting.
WorldServer Mode Length10 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To run pgAdmin 4 as a shared web application, install the package or official container, make its configuration and storage directories writable by the service account, complete first-run authentication to create the initial superuser, and serve it with one Python process. If it sits behind NGINX, Caddy, Apache, Gunicorn, or uWSGI, configure trusted forwarding headers. A deployment under /pgadmin4 also needs coordinated SCRIPT_NAME, proxy path rules, and cookie scope; otherwise login redirects commonly point at the site root.

What server mode is

Server mode is pgAdmin 4’s normal web-deployment model from version 2 onward. The desktop runtime changes that behavior automatically, but a server installation is intended for browser access by multiple authenticated users.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Users must log in before using the interface.
  • Initialization creates an initial superuser; that account can create additional superusers and non-superusers.
  • Each user’s file access is restricted to a virtual root below the configured STORAGE_DIR.
  • Some features require affinity to one database connection, so the deployment should use one Python process. Threads within that process are compatible with the representative Gunicorn setup, but multiple independent workers are not a safe default.

There is no published general user-count limit or performance benchmark in the official deployment material. Treat the documented Gunicorn values as a configuration example, not a capacity promise.

Choose a deployment shape before installing

Decide whether the host or a container will own the application files, and whether pgAdmin will be exposed directly or through a reverse proxy. The choice changes where you keep the configuration database, sessions, and storage.

#1 Best Overall
Sale
Gaoye Blue Light Blocking Glasses
  • BLUE LIGHT BLOCKING GLASSES: Our blue light glasses for women boast UV400 protection, blocking harmful blue rays from computer screens. With these bluelight glasses women, you can enjoy gaming, reading, or watching TV with no worries of eye strain.
  • EYE RELIEF: Our blue light glasses are engineered to reduce blurry vision or strain caused by prolonged screen time. These womens blue light glasses aid in better sleep by preventing blue light from disrupting your natural sleep cycle, helping you fall asleep faster and enjoy a more restful night's sleep, making them the perfect christmas present.
  • COMFORTABLE: Crafted from durable material, our trendy blue light glasses for woman or blue light glasses men ensure long-lasting comfort. The high-transmittance lenses accessories, gamer gifts for men, help keep your eyes relaxed. Perfect stocking stuffers, gifts for gamers men, christmas gifts for men, halloween costumes.
  • LIGHTWEIGHT: These clear blue light glasses feature a lightweight frame, meaning they’ll stay comfy for long-term wear. Perfect as blue blockers glasses for women or mens blue light glasses, these non-prescription fake glasses for men can be worn throughout the day. The blue light blocking glasses women feature polycarbonate HD lenses, which are anti-reflective and restore true color.
  • WORRY-FREE PURCHASE: If you experience any issues, our support team is ready to assist you quickly. These are the perfect costume glasses for cosplay dressing up.
Choice Best fit Operational points
Native package or Python wheel A host-managed service with local files and an operating-system service account You manage Python/package paths, writable directories, upgrades, and the WSGI server.
Gunicorn or uWSGI directly A simple internal endpoint or a deployment where another gateway already exists Run one Python process; use the installed pgAdmin application module and match paths to the package or wheel.
NGINX, Caddy, or Apache in front Public HTTPS, centralized access logging, certificates, and a stable front door Proxy to Gunicorn or uWSGI over a local TCP port or Unix socket. Sanitize forwarding headers.
Official container Docker, Kubernetes-style orchestration, or a restricted host Use dpage/pgadmin4, supply first-run credentials, persist the documented data/configuration locations, and expose a permitted port.
Root URL versus sub-directory Root hosting is simpler; a path such as /pgadmin4 is useful when sharing one hostname A sub-directory requires matching application and proxy prefix settings. A root deployment avoids that class of redirect and cookie errors.

Prepare a host-managed installation

Install the package or wheel

Use the package or Python-wheel method appropriate to the operating system, then identify the installed pgAdmin application module and the account that will run the web server. Keep the application code readable by that account, but do not make its private data world-writable.

Do not assume that paths from one installation method apply to another. The Gunicorn executable, Python environment, application module, configuration database, session directory, and STORAGE_DIR can all differ between a distribution package and a wheel-based virtual environment.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Create local settings without editing vendor defaults

When a default needs to change, create config_local.py beside pgAdmin’s config.py. This local file is the durable place for deployment-specific settings; editing the shipped file makes upgrades harder to audit and preserve.

Keep secrets and deployment-only values in the service’s protected configuration mechanism. The process must be able to read the local settings, while unrelated users should not be able to alter them.

Set directory ownership and permissions

Before the first launch, verify write access for every location pgAdmin uses at runtime:

  • the configuration database location;
  • session storage;
  • the configured STORAGE_DIR and its virtual-root contents; and
  • any other data directory selected by the package or local configuration.

Grant write permission to the account that runs Gunicorn, uWSGI, Apache’s WSGI process, or the container process. Keep these directories private to the service account and administrators. A successful page load does not prove that uploads, sessions, or configuration writes will work; test those operations after initialization.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Windex Gaming Cleaning Wipes, Pre-Moistened Wipes to Instantly Clean all Gaming Gear and Electronics, Resealable Packaging for a Freshness Lock, 25 count (Pack of 1)
  • WINDEX GAMING WIPES: effortlessly clean all your gaming gear and gaming electronics in one easy step with our new Windex Gaming Wipes
  • AMMONIA FREE: our ammonia-free formula is safe to use on all of your favorite gaming equipment like consoles, headsets, controllers, screens, keyboards, and more
  • PRE-MOISTENED WIPES: each wipe instantly removes dust, dirt, and stubborn smudges and fingerprints leaving a streak-free shine
  • ANTI-STATIC: great for cleaning and wiping down your gaming gear and electronics leaving behind no visible residue
  • COMPACT RESEALABLE PACKAGE: store your pack of Windex Gaming Wipes anywhere in your home for whenever a quick and easy wipedown is needed

Initialize authentication and the first account

  1. Start pgAdmin through the selected WSGI server or container entrypoint.
  2. Open the web endpoint in a browser. Server mode requires authentication before the interface is usable.
  3. Complete first-run initialization and create the initial superuser with a protected email address and password.
  4. Sign in with that account and create additional superusers or non-superusers according to your access policy.
  5. After confirming login, test a normal user account so that permissions and the virtual file root are not being inferred from superuser behavior.

Protect the initial credentials as carefully as any other administrative account. If the service is internet-facing, terminate HTTPS at the proxy or enable TLS in the container before distributing the login URL.

Run pgAdmin with one Python process

Gunicorn and uWSGI are supported standalone WSGI options. The important constraint is process count: features that depend on one database connection should not be split across independent Python workers. A representative Gunicorn invocation is:

gunicorn --workers=1 --threads=25 {{PGADMIN_APP_MODULE}}

Replace {{PGADMIN_APP_MODULE}} with the application module exposed by your installed package or wheel. Run the command from the environment containing pgAdmin, or use the full path to that environment’s Gunicorn executable. The documented --workers=1 --threads=25 values illustrate one process with multiple threads; they are not a measured throughput target or a promise that every installation should use exactly 25 threads.

If you choose uWSGI, apply the same one-process principle and pass the equivalent application, socket, and environment settings for your installation. Apache with mod_wsgi is another supported host-managed pattern. In every case, verify that the WSGI server can read config_local.py and write the runtime directories before putting a proxy in front.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Place NGINX, Caddy, or Apache in front

A reverse proxy can provide HTTPS, a public hostname, and access logs while Gunicorn or uWSGI listens only on localhost or a Unix socket. The proxy must pass requests to the WSGI server without allowing the browser to dictate pgAdmin’s idea of its external URL.

Sanitize forwarding headers

pgAdmin honors X-Script-Name and X-Scheme unconditionally. Consequently, the proxy must overwrite these headers with trusted values or remove them before forwarding a request. Never pass arbitrary client-supplied values through unchanged.

Rank #3
Sale
LISEN Cell Phone Stand Phone Holder for Desk, Office Decor Gadgets for Men
  • Ergonomic & Adjustable Design: Fight "text neck" and improve your posture. Designed for comfort, it offers an adjustable height (7.1in-8.5in) (1.4in adjustable range) and angle (5°-85°) Please note: cell phone stand is only 9 inches tall—the length of a standard pencil
  • Without blocking subtitles Perfect for office desk Tiktok Face Time Zoom video—this is the ultimate kitchen desk essential for phones! Perfect viewing experience while reducing neck back strain, A must-have for gamers streamers desk, and anyone who values both style and support!
  • Sleek & Stable Design fits Otterbox Case: Say goodbye to bent cables, tangles, and tip-overs! LISEN’s stylish adjustable desk phone holder features a built-in charging hole and smart cable management, keeping your phone secure and your workspace clutter-free cool gadgets for men
  • ANTI-SLIP DESIGN free hands: The under 10.00 items easy gadgets back and the bottom of this kitchen essentials for women are fully covered by anti-skid silicone, which LISEN stand up desk decor can provide maximum protection device from any scratches and slides
  • Your Perfect Viewing Companion:If your product arrives damaged or breaks within 365 days, reach out to LISEN for a quick and hassle-free solution. Struggling with assembly, like tightening the screw? We’ve got your back! Your experience matters to us. (Product including: phone Holder stand*1, screw*1, hexagon screwdriver*1, specification*1)
  • Set X-Scheme from the connection scheme that the proxy actually accepted, such as HTTPS, rather than trusting a value supplied by the client.
  • Set X-Script-Name to the configured external path when pgAdmin is mounted below a prefix; use an empty or absent value for a root deployment.
  • Apply the same policy on every matching location, including redirects generated for the bare path.

Proxy to a local TCP port or Unix socket. Keep the upstream private unless there is a deliberate reason to expose it directly; the public endpoint should be the proxy, not an unprotected WSGI listener.

Host pgAdmin at /pgadmin4 without redirect loops

Sub-directory hosting is a coordinated setting, not just an NGINX location name. Configure all three layers:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. WSGI environment: set SCRIPT_NAME=/pgadmin4 for Gunicorn or uWSGI.
  2. Proxy forwarding: preserve the /pgadmin4 prefix when forwarding and set the matching trusted X-Script-Name header.
  3. Path matching: proxy both the exact bare path /pgadmin4 and the wildcard path /pgadmin4/*. The bare request must reach pgAdmin so its redirect is generated under the same prefix.

Keep cookie scope and any external URL settings consistent with that prefix. If one layer removes the prefix while another generates links with it, the browser can receive a login redirect or session cookie aimed at the site root. The visible symptoms are a redirect loop, a login page that never establishes a session, or links that unexpectedly leave the sub-directory.

When troubleshooting, inspect the browser’s redirect location and cookie path first. A location header pointing to / instead of /pgadmin4 indicates that SCRIPT_NAME, proxy path preservation, or X-Script-Name is inconsistent. A cookie scoped to the wrong path produces a similar result even when the first page appears correct.

Deploy the official container

Supply first-run credentials

The official image is dpage/pgadmin4. Provide the documented first-run variables:

[email protected]
PGADMIN_DEFAULT_PASSWORD=use-a-long-unique-secret

The values above illustrate the variable names; choose an address and secret appropriate to your environment. The entrypoint uses them to initialize the first account, so treat the password as an administrative credential rather than a disposable test value.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Ledagic IC+RGBW USB Powered Led Light Bar with App & Remote Control, 2 Pack
  • Easy Installation: Our gaming lights have been designed to enhance your entertainment experience. Simply position the led light bar next to your TV or game console to create a game room environment with ease. They come with USB power and a 60 inch cord for direct mounting and mobility
  • Audio Syncing & Extensive Mode: The built-in high-sensitivity music sensor allows you to sync the TV led lights to your favorite music. Lights react and move to the beat of music, film and game audio, creating an incredible immersive sound and light experience – and all without the need for an additional hub. You can choose from 64+ patterns, including strobe, illusion, jump, energy, gradient, running, chasing, fluttering mode etc. Each mode can be applied to different scenes
  • 64+ Chasing IC+RGB & W Effect: The independent control design of IC+RGB and white all-in-one multifunctional rgbw led bar lights monitor backlight allows you to easily switch the led lights for desk between IC+RGB and white to enjoy a variety of lighting effects, you can choose white lighting mode with high brightness for better illumination when working, etc. Choose IC+RGB lighting mode when you need to create an entertaining atmosphere for the light show, 16 million colours of Color changing rgb light bar let you dance to the beat and create a dynamic party atmosphere
  • Dynamic and Dimmable Lights: 1%-full brightness free brightness adjustment gives you the flexibility to adjust dimmable led light bar for room decorations or a variety of occasions
  • USB Powered: USB light bars for room can be powered by powernank, usb charger, TV, Monitor, laptop PC mainframe, making behind TV led lighting bar easy to install in any location.TV led lights are powered by the TV usb interface / PC mainframe, can be turned on/off synchronously with TV / PC

Persist data and configuration

Map the documented pgAdmin data/configuration locations to durable host or orchestration volumes. Without persistent mounts, the configuration database, sessions, and other instance state can disappear when the container is replaced. Ensure the container process can write those mounts and that the host permissions do not expose them to unrelated users.

Container environment variables beginning with PGADMIN_CONFIG_ can override settings. For durable, reviewable local changes, config_local.py remains the preferred override mechanism when the image and deployment layout support it.

Enable container TLS when the proxy is not terminating HTTPS

Set PGADMIN_ENABLE_TLS=True and mount the certificate and private key where the image expects them. If a reverse proxy already terminates HTTPS, keep the internal hop protected according to your network trust model and ensure the proxy supplies the correct trusted scheme header.

Understand servers.json timing

Definitions in servers.json are imported when the configuration database is created for the first time. They are not reloaded on every restart. To change those definitions after initialization, use pgAdmin’s administration interface or deliberately manage the configuration database; restarting the same container alone will not re-import the file.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use non-privileged ports in restricted environments

OpenShift and containers launched with --cap-drop=ALL are supported deployment contexts. When the security context does not permit privileged ports, the entrypoint can select non-privileged listeners such as HTTP port 8080 and TLS port 8443. Publish or route those internal ports through the platform’s service or ingress rather than granting extra capabilities solely to bind a low port.

Security and operations checklist

  • Terminate HTTPS at the reverse proxy or enable container TLS before exposing the login endpoint.
  • Protect the initial superuser email and password, and create separate accounts with only the required role.
  • Restrict write access to the configuration database, session storage, STORAGE_DIR, and local settings.
  • Run one Python process. Do not increase Gunicorn or uWSGI worker count to chase capacity without an architecture that preserves the connection affinity required by pgAdmin features.
  • Overwrite or remove incoming X-Script-Name and X-Scheme headers.
  • For a URL prefix, test both the bare prefix and a path below it, then verify redirect locations and cookie scope.
  • Persist container data/configuration mounts and document which files are initialization-only.
  • Keep the WSGI socket or local TCP listener inaccessible from untrusted networks when a reverse proxy is present.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting by symptom

The page loads, but login redirects to the site root

Check whether the deployment is intended to live at the root or at /pgadmin4. For the sub-directory case, set SCRIPT_NAME=/pgadmin4, preserve that prefix in the proxy, send the matching X-Script-Name, and proxy both exact and wildcard paths. Remove any client-provided conflicting headers.

Best Value
Sale
HUANUO FlowLift™ Dual Monitor Stand, Fully Adjustable Gaming Monitor Desk Mount for 13–32″ Computer Screens, Full Motion VESA 75x75/100x100 with C-Clamp & Grommet Base, Each Arm Holds 4.4 to 19.8 lbs
  • Compatible with Wide Screens - To ensure compatibility with the dual monitor mount, your each monitor must meet three conditions at the same time: First, computer screens size range: 13 to 32 inches. Second, screen weight range: 4.4 to 19.8 lbs. Third, the back of the monitor screen must have VESA mounting holes with a pitch of 75x75mm or 100x100mm.
  • Regarding the compatibility with desks - Your desk must meet three conditions at the same time: First, desk material: Only wooden desks are recommended, plastic or glass desks cannot be used. Second, desk thickness range: 0.59" - 3.54". Third, the bottom of the desk should not have any cross beams or panels, as this will interfere with installation. We recommend carefully checking that your desk and monitors meets all above conditions before purchasing.
  • Dual C-Clamp Hold - Worried your dual monitors might wobble or slip? Our upgraded base uses a larger platform plus a dual C-clamp structure to lock the dual monitor arm firmly to your desk. Each arm safely keeps your screens steady while you type, click and game—no shaking, no sliding, just a clean and secure setup you can trust every day. It also provides Grommet Mounting installation choice, both options ensure stable and secure fixation for your 0.59" - 3.54" desk.
  • Full-Motion Adjustment For Comfortable View - Pull the screen closer when you’re deep in a spreadsheet, push it back to watch videos, or rotate to portrait for coding — moving everything smoothly with just one hand. The monitor stand offers +85°/-50° tilt, ±90° swivel and 360° rotation. Raise your monitor up to 15.75″ to support a healthy sitting posture. Whether you’re working from home, gaming through the night, or switching between video calls and documents, getting the screens to your natural line of sight helps relieve neck, shoulder and back strain so you can stay focused longer with less fatigue.
  • Keep Your Desk Organized: By lifting both screens off the desktop, this dual monitor stand opens up valuable space for your keyboard, notebook, docking station or a simple, clutter-free work area. Built-in cable management guides wires along the arms, keeping cords out of sight and out of the way. Enjoy a tidy, modern workstation that looks as good as it feels to use.

Login succeeds but the session immediately disappears

Inspect the cookie path and external scheme. A root-scoped cookie in a sub-directory deployment, or a scheme mismatch between HTTPS at the proxy and HTTP at the upstream, can prevent the browser from returning the cookie as pgAdmin expects. Correct the coordinated prefix and trusted scheme settings, then clear the old cookie and retry.

Uploads or saved files fail with a permission error

Confirm that the actual service account—not just your interactive shell user—can write the configuration database, session directory, and STORAGE_DIR. Check parent-directory traversal permissions as well as the final directory, and keep the resulting access limited to the service account and administrators.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The proxy returns a gateway error

Verify that Gunicorn or uWSGI is running, that the proxy points to the same Unix socket or local TCP port, and that the WSGI process can import the installed application module. A package and its virtual environment can expose different executable paths, so use the environment in which pgAdmin was installed.

Adding a worker appears to break features

Return to one Python process. pgAdmin documentation warns that some features need affinity to one database connection; multiple independent workers can route related requests to different connections and produce failures that do not occur with the single-process arrangement.

Container server definitions did not change after a restart

That behavior is expected when the configuration database already exists. servers.json is consumed during first configuration-database creation, not every restart. Change the definitions through the running instance or recreate the initialization state only when that data loss is intentional and backed up.

The container cannot bind its configured port

In restricted security contexts, use the non-privileged HTTP and TLS ports supported by the entrypoint—8080 and 8443 are the documented examples—and route traffic through the platform or an ingress controller. Do not add capabilities merely to bind a low port unless your security policy explicitly permits it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Root URL or sub-directory: which should you use?

Requirement Root deployment /pgadmin4 deployment
Application setting No path prefix is required. Set SCRIPT_NAME=/pgadmin4.
Proxy paths Match the root endpoint and its descendants. Match both /pgadmin4 and /pgadmin4/*.
Forwarded script header Remove or set an empty trusted value. Set X-Script-Name=/pgadmin4 after removing the client value.
Failure most often seen Incorrect scheme or unsanitized headers. Redirects, links, or cookies aimed at the site root.
Operational complexity Lower. Higher, because application, proxy, and cookie scope must agree.

If you control a dedicated hostname, root hosting is the less error-prone choice. Use a sub-directory when the shared hostname requirement justifies the additional coordination and test both prefix paths before granting users access.

Final verification before handing over the URL

  1. Open the public URL over HTTPS and confirm that the browser remains on the intended host and path.
  2. Log in as the initial superuser, then test a separate non-superuser account.
  3. Create a small server definition or other permitted object and confirm that the configuration database is writable.
  4. Exercise a file operation and confirm that it remains within the user’s virtual root.
  5. Restart the WSGI process or container and verify that state persists from the configured directories or mapped volumes.
  6. Review proxy logs for unexpected client-supplied forwarding headers and ensure the upstream listener is not publicly reachable.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.