Recommended Free Tools
For a production web2py application, place Nginx at the edge, run web2py through uWSGI, and keep PostgreSQL as a separately protected stateful service. Docker is optional. It can make the application and Nginx build repeatable, but it does not solve database persistence, backups, secrets, upgrades, monitoring, or network security.
Antihost offers VPS plans with one-click Docker, NVMe storage and a 14-day free trial.
A conventional host installation follows web2py’s documented deployment path most directly. Docker is a sensible alternative when your team already builds images and operates Compose or an orchestrator. The right choice depends less on performance than on which operating model you can maintain, secure, back up, and recover.
As an Amazon Associate I earn from qualifying purchases.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Repair Windows errors before they cause bigger problems3Fix the driver behind crashes, sound loss and screen glitchesThe production architecture web2py expects
web2py’s built-in Rocket server has limited configuration capability. The official manual therefore recommends placing web2py behind a production web server such as Nginx, Apache, Lighttpd, or Cherokee. With Nginx, the application is exposed through WSGI and uWSGI: Nginx speaks its own protocol, while uWSGI provides the adapter that passes requests to the WSGI application.
A practical production flow is:
- A client connects to Nginx over HTTPS.
- Nginx terminates TLS and serves static assets directly.
- Requests requiring Python execution are passed to web2py through uWSGI.
- web2py opens a private connection to PostgreSQL.
This separation gives each tier a clear responsibility. Nginx handles public traffic and certificates, uWSGI supervises application workers, and PostgreSQL owns durable application data. The database should not be made publicly reachable simply because the web tier is public.
#1 Best Overall
Conventional installation: the path closest to the documentation
Choose a conventional installation when you want services managed by the operating system, when your team already uses host configuration management, or when a managed PostgreSQL server will live outside the application machine. This approach avoids container-specific decisions while matching the deployment pattern described in the web2py manual.
1. Install the service layers
Install Nginx, uWSGI and PostgreSQL using the packages appropriate for your Linux distribution. Install the Python PostgreSQL adapter required by the web2py application as well. Keep the web tier and database tier on separate machines when practical; otherwise isolate PostgreSQL on a private interface and firewall its port.
Free tools Windows power users keep installed
One-click scans. No signup required.
The conventional PostgreSQL port is 5432. Treat that number as an internal service detail, not an invitation to expose the database to the internet.
2. Create the Nginx server block
The manual’s English Nginx example creates /etc/nginx/sites-available/web2py. The server block serves application static files and forwards dynamic requests to the Unix socket unix:///tmp/web2py.socket while including uwsgi_params.
A deployment normally enables that site in the distribution’s Nginx configuration, validates the configuration, and reloads Nginx after changes. Keep the TLS listener separate from the plain HTTP listener if you need an HTTP-to-HTTPS redirect. The TLS block needs the certificate and private-key paths issued for your hostname; do not copy example paths into production without replacing them with the actual files and permissions.
3. Run uWSGI for web2py
Configure uWSGI to load the web2py WSGI application and create the socket Nginx expects. The socket path, ownership, permissions, worker count, timeout policy and restart behavior must agree between uWSGI and Nginx. A socket that exists but is owned by a user Nginx cannot access produces gateway errors; a socket path that differs by even one character produces the same symptom.
Rank #2
4. Configure the database connection
web2py’s DAL uses a PostgreSQL connection string in this form:
db = DAL("postgres://myuser:mypassword@localhost:5432/mydb")
Replace the illustrative username, password, host and database name with credentials created for this application. If PostgreSQL is on another machine, use its private address or an internal DNS name and enforce firewall rules so only the web tier can connect.
5. Enable maintenance features and backups
Enable PostgreSQL autovacuum, which the manual specifically recommends. Schedule regular pg_dump backups and periodically test restoration with pg_restore. A backup that has never been restored is an assumption, not a recovery plan.
Docker or host services: what actually changes?
Docker changes packaging and process boundaries; it does not change the responsibilities of the architecture. Nginx still needs TLS and a safe public boundary, uWSGI still needs to reach web2py, and PostgreSQL still needs durable storage and controlled access.
| Decision area | Conventional host installation | Docker-based installation |
|---|---|---|
| Repeatability | Repeatable through package pinning and host configuration management. | Repeatable through versioned images and build files. |
| Database state | Stored on managed disks or a dedicated database host. | Must be mounted outside the disposable container layer and included in backup and restore procedures. |
| Operations | Uses the operating system’s service manager, logging and upgrade tools. | Requires deliberate logging, metrics, supervision, health checks, resource limits and image lifecycle procedures. |
| Network boundary | Controlled with host firewalls, private interfaces and Nginx configuration. | Controlled with container networks plus host and cloud firewall rules; published ports still expose services. |
| Rollback | Depends on package and configuration rollback procedures. | Can use a previous image, provided database schema compatibility and persistent data have been considered. |
| Documentation fit | Closest to the official web2py deployment recipe. | Requires validating the selected image, base operating system, Python version and PostgreSQL compatibility. |
When Docker is a good fit
Docker is reasonable when the team already has a trusted image-building process, uses Compose or an orchestrator, and treats infrastructure as versioned configuration. It can package web2py, uWSGI and Nginx consistently across staging and production, making a new environment less dependent on manual host changes.
Containerization is particularly useful when you need to reproduce the same application image for testing, deploy through an existing registry, or run several isolated application versions on shared infrastructure. Those benefits come from disciplined image and configuration management, not from Docker alone.
What a production Docker design must include
- Version-pinned images: record the Python, web2py, uWSGI, Nginx and PostgreSQL versions in the deployment repository. Avoid an unqualified
latesttag. - Persistent PostgreSQL storage: mount database data on durable storage outside the disposable container layer. Define how that storage is snapshotted and restored.
- Secrets handling: provide database credentials and TLS private keys through the platform’s secret mechanism rather than baking them into an image or committing them to source control.
- Health checks: check that Nginx, uWSGI and PostgreSQL are actually ready, not merely that their processes exist. Startup ordering alone does not guarantee database readiness.
- Resource limits: set CPU and memory boundaries so a runaway worker or query cannot consume the host.
- Log retention: send access, error and application logs to a retained destination with rotation and an agreed retention period.
- Upgrade and rollback procedures: test application-image changes against a copy of production data and define what happens if a schema migration cannot be reversed.
A Docker Hub listing demonstrates a minimal image combining Nginx and web2py for production deployment. The available evidence does not establish that this image has a maintained tag, published security policy, Compose specification, PostgreSQL compatibility statement or health checks. Treat such an image as an example to inspect, not as an automatic production standard. Building and maintaining your own reviewed image may be more work initially but gives you control over its base packages and update cadence.
Keeping PostgreSQL private and recoverable
The web2py manual says it is wise to run web servers and the database on different machines connected by a secure internal network or an SSL tunnel. This arrangement limits the blast radius of a compromised web process and lets the database be maintained independently.
Authentication and privileges
Create a database role limited to the application’s required database. Do not use a superuser for normal web requests. The manual includes illustrative authentication settings, but an example using trust authentication must not be copied into an internet-facing deployment without a security review. Require password or certificate authentication appropriate to your network, and restrict permitted source addresses.
Backups and recovery
Use scheduled pg_dump jobs and store the resulting files outside the database host. Protect them like production data because they contain application records and may contain sensitive information. Perform documented pg_restore recovery drills, recording how long restoration takes and which application configuration must be recreated before traffic can return.
Nginx, TLS and administrative endpoints
Terminate HTTPS at Nginx and keep web2py administrative interfaces off the public network whenever possible. The manual warns that exposing the admin or appadmin interface without HTTPS is dangerous. A valid certificate is necessary but not sufficient: restrict administrative routes by network policy, authentication and, where appropriate, a separate management hostname.
Serve static files through Nginx so ordinary asset requests do not consume Python workers. Forward only dynamic requests to the uWSGI socket. Review upload limits, request timeouts and access logs for the application’s traffic pattern rather than accepting distribution defaults without testing.
Version and maintenance decisions in 2026
Project documentation states that web2py 2.27.1 is the last version supporting Python 2.7. web2py 3.x supports Python 3.9 and newer and is in limited maintenance mode; the project recommends moving to its successor, py4web.
That lifecycle information should be part of the deployment decision. For an existing web2py system, pin the currently supported Python and web2py versions, document them, and test upgrades in a non-production environment. For a new project, evaluate whether py4web or another actively maintained framework better fits the requirements before investing in a long-lived web2py platform.
Regardless of packaging, record the selected versions of Python, web2py, Nginx, uWSGI, PostgreSQL and operating-system packages. Re-check compatibility before upgrades because maintenance status and available images can change.
Operational checks before opening the service
- HTTPS reaches Nginx with the intended certificate, and HTTP traffic is handled according to your redirect policy.
- Nginx can read static files and can write or access the uWSGI socket as configured.
- A dynamic web2py request reaches uWSGI without a 502 error.
- The application can connect to PostgreSQL using its least-privilege role.
- PostgreSQL listens only on the required private interface and firewall rules reject unrelated sources.
autovacuumis enabled and observable.- Backups complete on schedule, are stored separately, and have passed a
pg_restoretest. - Container deployments, if used, have persistent volumes, health checks, resource limits, secret injection and log retention.
- Administrative endpoints are protected and are never exposed without HTTPS.
Troubleshooting common failures
Nginx returns 502 Bad Gateway
Check that uWSGI is running, that it created /tmp/web2py.socket, and that Nginx has permission to access it. Confirm that the Nginx uwsgi_pass value and the uWSGI socket path match exactly. Then inspect both Nginx’s error log and the uWSGI log for application-import or permission errors.
Static files work but dynamic pages fail
This usually indicates that Nginx’s static location is correct while the uWSGI hand-off is not. Verify that the request is routed to the dynamic location, that uwsgi_params is included, and that uWSGI is loading the intended web2py application and Python environment.
The application cannot connect to PostgreSQL
Validate the host, port 5432, database name and role in the DAL string. From the web tier, test network reachability to the private database address, then review PostgreSQL’s listen addresses, host-based authentication rules and firewall policy. Do not solve a connection problem by opening PostgreSQL to the public internet.
A container loses data after recreation
PostgreSQL data was probably written only inside the container’s disposable layer. Stop the service, attach a durable volume or managed disk, restore the latest verified backup with pg_restore, and document the volume mapping before recreating the stack.
A practical choice for your project
Choose a conventional host deployment when
- You want the closest match to web2py’s official Nginx and uWSGI instructions.
- Your organization already manages servers with packages, system services and configuration management.
- PostgreSQL will run on a managed service or dedicated database host.
- The team does not yet have reliable container logging, image scanning, secret management and rollback procedures.
Choose Docker when
- Image builds and container orchestration are already standard operating practice.
- You need reproducible application environments across development, staging and production.
- You are prepared to design persistent storage, health checks, limits, logs, secrets, upgrades and recovery rather than treating them as defaults.
In either case, the production design remains Nginx for TLS and static content, uWSGI for the WSGI boundary, and a private PostgreSQL service with tested backups. Docker is a packaging decision layered on top of that architecture, not a replacement for it.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →Quick Recap
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.




