What CKAN behind uWSGI and NGINX does for a production portal
A team moving a CKAN portal from a development server to public traffic needs a production web layer in front of the application. CKAN recommends uWSGI to run the application processes and NGINX as the reverse proxy that handles TLS, upload size limits and static assets. In this layout, NGINX receives every request from the network, serves static files directly, and passes dynamic requests to uWSGI, which runs the CKAN application. The CKAN install from source documentation names uWSGI and Nginx as the recommended production components, alongside PostgreSQL, Solr and Redis, which the portal needs regardless of the web layer.
You need this layer for any portal reachable from the internet or from a shared network where many people or systems connect to it. Internal catalogs on a corporate network fall in the same group, since the reverse proxy is where TLS and access logging are handled for them too. Decide early who owns the NGINX configuration and certificates, whether NGINX runs on the same host as uWSGI or on a separate load balancer, and how the uWSGI socket is exposed between them. Confirm each choice against the documentation for your CKAN version and your install method, because package and container installs may wire these pieces differently and the source guide is the reference for the recommended stack.
The upload limit is the setting teams most often get wrong. CKAN controls resource size through ckan.max_resource_size in ckan.ini, while NGINX enforces its own request body limit before the request reaches CKAN. If NGINX's limit is lower, users see a proxy error on uploads that CKAN would have accepted, so the two values must be set together and tested. Run a test upload just under the configured limit and another just above it, and check that each returns the response you expect. Then confirm that NGINX serves the CSS, JavaScript and image files directly, and that static asset handling is not slowing page loads. Record both settings in the same change so a later edit to one does not silently break the other.
Requests reach CKAN only through NGINX and uWSGI
The diagram starts with a browser or API client sending an HTTPS request from the public network to NGINX, which terminates TLS and enforces the upload size limit. NGINX answers static asset requests directly and passes dynamic requests to uWSGI, which runs the CKAN application. CKAN then calls PostgreSQL, Solr and Redis, each running as a separate data service. Check that the NGINX upload limit matches ckan.max_resource_size, and confirm that only NGINX accepts traffic from the public network.
Requests flow from public clients through NGINX and uWSGI into CKAN and its data services.
Choosing uWSGI and NGINX settings for CKAN
This table compares the main settings in a CKAN uWSGI and NGINX stack, with the choices available for each and the conditions where each one fits. Read each row alongside your expected concurrent users, your largest resource uploads, and your TLS layout. The main takeaway is that the NGINX upload limit, proxy timeouts and uWSGI capacity must be set together, and exact directive names and defaults should be confirmed in the CKAN documentation for your release.
| Setting area | Choice | When it fits |
|---|---|---|
| uWSGI processes and threads | Fewer processes with more threads, or more processes with fewer threads, sized to host memory and CPU | Every production host. Each process uses its own memory, so raise counts only after load tests confirm headroom for expected concurrent requests. |
| Socket or HTTP between NGINX and uWSGI | Unix socket on the same host, or HTTP to a separate host or container | A Unix socket suits one host running both services. HTTP suits split hosts or containers, and the upstream should sit on a private network. |
| NGINX client_max_body_size | Value matched to ckan.max_resource_size, with a small margin for form overhead | Any portal accepting uploads through the web interface. Change both values together and test a file near the limit end to end. |
| Proxy timeouts | Longer timeouts on upload and download locations, shorter timeouts on page and API locations | Portals with slow uploads over long links or large downloads. Short timeouts elsewhere limit how long stuck requests hold workers. |
| TLS termination | NGINX terminates TLS on the CKAN host, or a load balancer terminates TLS and forwards plain HTTP | NGINX suits one entry point you control. A load balancer suits shared edge certificates, but forwarded protocol headers must reach CKAN so it builds HTTPS links. |
| Static assets | NGINX serves static and webassets paths directly, or CKAN serves them through uWSGI | Production portals, so static requests do not occupy uWSGI workers. Serving through CKAN suits only quick test installs. |
Why upload limits must agree across NGINX and CKAN
A resource upload can fail at NGINX before CKAN ever receives it, so the NGINX body size limit must be at least as large as the CKAN maximum resource size set in ckan.max_resource_size. NGINX enforces the client_max_body_size directive on the request body in the reverse proxy layer that sits in front of uWSGI. When a request is larger than that directive allows, NGINX stops it and returns its own error page. CKAN's logs and upload form never see the request, so the reviewer gets a generic web server error instead of a message explaining that the resource is too large. Treat the two values as one setting split across two files: the CKAN configuration and the NGINX site configuration.
Change both values in the same change request. If only one is raised, the symptom looks like a CKAN fault to the people testing it, and the fix often lands in the wrong layer. Raising client_max_body_size alone lets larger bodies reach CKAN, which then rejects them with its own message, so users see an inconsistent limit. Raising ckan.max_resource_size alone changes nothing for users, because NGINX still stops the upload first. Review both files together, record the CKAN release in use, and confirm the maximum resource size for that release in the FileStore and upload limits topic, which covers the default and the allowed values. Reload NGINX and restart the CKAN web processes so both changes take effect together.
Test the boundary with two resource uploads, one through the web form and one through the API. Use a file slightly below the configured CKAN limit, which should succeed and show the resource on the dataset page, and a file slightly above it, which should be rejected with a CKAN validation message. If the larger file returns a plain NGINX error page, the NGINX limit is still too low. If CKAN rejects it with its own message, the NGINX limit is set correctly. Run the API check as well, since large API requests pass through the same proxy. Confirm each value in your own environment against the release you run, and keep both test results with the change record so the next upgrade repeats the same check.
Setting up uWSGI and NGINX in front of CKAN
This sequence takes a CKAN installation from its prerequisites to a production web stack in which uWSGI runs the application, NGINX terminates TLS and proxies traffic, and uploads and static assets behave consistently. Each step closes with a check you can run before moving on. Confirm every directive and configuration key against the documentation for your CKAN version before you apply it.
Install the CKAN prerequisites
Install Python 3.10 or newer, PostgreSQL 12 or newer, Solr 9 (recommended) or Solr 8, and Redis, following the CKAN source install guide for your operating system. Your platform or systems team usually performs this work on the servers, and the CKAN application itself goes into a Python virtual environment. The step is done when each service reports its version and responds: check the Python and PostgreSQL versions on the command line, confirm Solr answers on its admin page, and get PONG from redis-cli ping.
Run CKAN under uWSGI with a config file
Install uWSGI into the CKAN virtual environment and write a configuration file that loads the CKAN WSGI application, sets process and thread counts suited to your hardware, and binds to a local socket that NGINX can reach. Keep the file under version control with the rest of your deployment definitions. Confirm the module and option names against the uWSGI and CKAN documentation for your version. The step is done when uWSGI starts cleanly under your service manager and a request sent to the socket returns a CKAN response.
Place NGINX in front as reverse proxy
Create an NGINX server block that forwards requests to the uWSGI socket and passes the original host and protocol headers, so that CKAN generates correct links and redirects. Set ckan.site_url to the public address so that links and asset URLs match what users see in the browser. The step is done when nginx -t reports a valid configuration and a request to the public hostname returns the CKAN home page through NGINX.
Configure TLS and redirect plain HTTP
Install the certificate and private key issued by your internal certificate authority or a public certificate authority, listen on port 443 with TLS, and add a port 80 server block that returns a permanent redirect to HTTPS. Restrict read access to the private key to the NGINX service account, and confirm the protocol versions and cipher settings against your own security baseline. The step is done when a client that trusts your certificate authority completes the TLS handshake and a plain HTTP request to the site returns a redirect to the HTTPS address.
Match the NGINX upload limit to CKAN
Set client_max_body_size in NGINX so that it is at least as large as ckan.max_resource_size, and check whether uWSGI or any load balancer in front of NGINX imposes its own request size limit. A limit set in one layer only works if every layer allows the same size. Confirm the units and defaults for your CKAN version in the documentation. The step is done when a file just under the CKAN limit uploads successfully and a file above it is rejected by NGINX with a 413 response.
Serve static assets through NGINX
Configure NGINX to serve CKAN's static files and webassets directly from disk with cache headers, so that uWSGI handles only dynamic requests. Confirm the static and webassets paths and the storage directories for your CKAN version in the documentation, and make sure the NGINX user can read those directories. The step is done when the stylesheet and JavaScript URLs referenced by a page return 200 from NGINX and the page renders with its styles intact.
Check service health and page loads
Confirm that uWSGI, NGINX, PostgreSQL, Solr and Redis are running under their service managers, and that CKAN's status_show API action responds through the public URL. In a browser on a clean session, load the home page, a dataset page and a page that uses a stylesheet, and check the developer console for blocked or mixed content. The step is done when every check passes from a clean browser session and the status endpoint reports a healthy application.
Run a large upload test and review logs
Upload a resource close to the configured limit and confirm that it is stored and listed, then upload a file just above the limit and confirm the rejection. Afterward, review the NGINX access and error logs, the uWSGI log and the CKAN log for 5xx responses, timeouts and upload errors. The step is done when the test results match the configured limits and the logs show no unexplained errors. Record the limit values and test results with the change record for your audit trail.
Security controls at the NGINX and uWSGI layer
These controls sit between the internet and the CKAN application. Each one narrows what a request can reach, how much it can consume, or what evidence remains afterward. Confirm each setting in your own environment, because the values that suit a public open data portal often differ from those that suit an internal catalog.
TLS certificates and protocol settings
Terminate TLS in NGINX with a certificate chain your clients trust, and renew it on a schedule your team can monitor. Restrict protocol versions and cipher suites to what your security baseline allows, and confirm that plain HTTP requests redirect to HTTPS. Only enable HSTS where the domain owners agree to it. Check the protocol list after every change, because a successful reload does not prove which certificate and protocol settings clients receive. Confirm certificate ownership and private key storage rules with your security team.
uWSGI behind a local socket
Bind uWSGI to a Unix socket or a loopback address so that NGINX is the only public entry point to CKAN. Set the socket option in the uWSGI configuration and do not expose a public http listener. Confirm that the host firewall blocks the uWSGI port from other machines, and test from outside the host that the application port does not answer. If you run more than one web server, repeat the check on each one and record who owns the firewall rule.
Request size and timeout limits
NGINX limits request bodies with client_max_body_size, and the NGINX limit must agree with CKAN's own upload setting (ckan.max_resource_size). When both match, oversized uploads are refused at the edge with a clear error and do not fail partway through the application. Set read, send and proxy timeouts so that slow clients and stuck workers cannot hold connections open indefinitely. Confirm the values against your largest expected upload and the slowest page your users open, and test an upload that is just over the limit.
Static and application path separation
NGINX should serve static assets and uploaded files from their own locations, and pass only dynamic requests to uWSGI. Map the static directory CKAN uses for assets, and the FileStore path if you store uploads on local disk, with explicit location blocks. FileStore served from disk can bypass CKAN access rules, so private resources may be reachable by anyone who knows the path. Confirm that directory listings are off, that the static root cannot reach configuration files, and that FileStore permissions match your private dataset policy.
Access logs and retention
Enable access logs in NGINX and keep uWSGI logs for the application server, then decide how long each is kept and who can read them. Access logs record client addresses, requested paths and status codes, so they can contain personal data from account pages and API calls. Set a retention period that your privacy team approves and confirm that log rotation runs. Query strings can carry API keys, so check whether any client sends keys that way before you enable full request logging.
Patching NGINX and uWSGI on the host
NGINX and uWSGI are separate packages with their own security fixes, so they need their own update routine alongside the Python runtime that CKAN uses. Patch NGINX and uWSGI on a fixed routine, and confirm which package source your host uses and who is notified when a fix ships. Reload or restart each service after updates, then verify that the running version matches what you expect. Plan CKAN patch releases in the same cycle, because the project supports the latest patch of the current minor version and the previous minor version.
CKAN release policyServing static assets and TLS at the edge
Serving CSS, JavaScript and images from NGINX keeps those requests away from the uWSGI processes that run CKAN's Python code, so application workers spend their capacity on dataset pages, search and API calls. Map an NGINX location to the directory set by ckan.webassets_path and serve each theme's public files from their own location. After the move, check three things. Confirm that static responses carry the Cache-Control and expiry values you chose, and that HTML pages are never cached by a shared layer. Test every page after each CKAN upgrade, because generated asset paths can change between releases. Finally, confirm that files shipped by custom extensions, including theme images, stylesheets and scripts, still resolve, since a missing file returns a 404 from NGINX without any application error in the logs.
Terminating TLS at NGINX keeps the certificate, private key and protocol policy on the proxy, which passes plain HTTP to uWSGI on the local host. Your security team should set the accepted TLS versions and cipher policy, and port 80 should redirect to HTTPS. When a cloud load balancer or Kubernetes ingress terminates TLS instead, the certificate and renewal process move to that layer, and NGINX usually receives plain HTTP from it. The trust boundary then moves outward: the load balancer or ingress controller becomes the only component that should set forwarded headers, and NGINX has to overwrite or reject headers sent by anyone else. Confirm the certificate renewal owner and the internal hop encryption policy with your platform team before you choose this design.
CKAN must know the public scheme and hostname to build correct links, redirects and absolute URLs. Set ckan.site_url to the public HTTPS address, and make the proxy pass Host, X-Forwarded-Proto and X-Forwarded-For to the application. Check how your CKAN version and WSGI stack interpret those headers before go-live. Trusting them from any client allows spoofed client addresses and scheme values, while ignoring them produces redirects back to http or mixed content on pages. Verify with a test: request the login page through the public name, confirm that redirect and asset URLs use https, and confirm that the client address in the application logs is the real visitor's. Record the list of trusted proxy addresses in your runbook so any change to the load balancer or ingress gets reviewed.
Limits and what to confirm in your environment
The web stack in this topic is only as current as the CKAN version and the platform it runs on. The cards below cover the CKAN release rules, the configuration values that change by version and host, and the host details to confirm before you commit to a build.
Minor releases change behavior
CKAN targets about two minor releases a year, and minor releases may include backwards-incompatible changes. A minor upgrade can therefore change behavior that your uWSGI, NGINX and upload settings depend on. Retest the whole web stack on every minor upgrade, including sign-in, resource upload, the API and static assets. Patch releases do not break backwards compatibility under the release policy, but a short smoke test after each one is still a sensible check.
CKAN release policySupport windows set the pace
The CKAN tech team supports the latest patch of the current minor version and the previous minor version. An outdated patch loses support once a newer patch is out, so a portal that stays on an old patch gets no further security or bug fixes from the project. Check which line your portal is on before you schedule any change. Set a patch cadence for the whole web stack so the proxy, uWSGI and Python packages do not drift behind CKAN.
Confirm directives and defaults
Sample uWSGI and NGINX configuration is a starting point that must be checked against the current documentation for the versions you install. Confirm each directive and its default, including client_max_body_size in NGINX and the uWSGI settings for workers, buffers and timeouts. Record the value you chose and the version it was checked against, so a later reviewer can see why it differs from a default and whether it still applies after an upgrade.
Trace TLS and limits through containers
On Kubernetes or other container hosts, TLS and request size limits often sit in an ingress controller, a cloud load balancer or a sidecar proxy, and the NGINX file you wrote for a server may not be in the request path at all. Find every layer that terminates TLS or limits request bodies. Set each one to at least the size allowed by ckan.max_resource_size, then confirm the smallest limit in the chain by uploading a file through the same route your publishers use.
Plan disk and timeouts for uploads
Large resource uploads depend on more than a size setting. The FileStore needs free disk space for each file, and the proxy, uWSGI and CKAN all have timeouts that must allow the transfer to finish on your network. Check the free space on the volume that holds the FileStore and any temporary upload space, and decide the largest file publishers will send. A timeout at any layer can look like a CKAN fault, so test a transfer near that size end to end before you publish the limit.
Confirm the host operating system
CKAN's package install guide covers Ubuntu 20.04 and 22.04 64-bit. Source installs work on other systems such as Red Hat, Fedora and CentOS, but they change how Python, PostgreSQL, Solr and Redis are installed and how services start. Confirm your host OS and its version before you plan the build. Check that Python 3.10 or newer, PostgreSQL 12 or newer and Solr 9 (recommended) are available on it, and that your security team supports that release.
Source install guideHow much effort and cost does a CKAN uWSGI and NGINX setup take?
What drives the cost and effort of a CKAN uWSGI and NGINX setup?
The main drivers are the number of hosts, who owns TLS and DNS, how large uploads may be, whether an existing load balancer sits in front, and how much testing the portal needs before go-live. A single host with NGINX in front of uWSGI is the simplest case. Each extra web host, worker host or load balancer adds configuration, health checks and certificate handling. Upload limits need care because ckan.max_resource_size must match the NGINX request body limit and any limit on the load balancer, so every layer needs checking. If an existing load balancer already terminates TLS, the work shifts to agreeing on headers, timeouts and where certificates live. Testing adds effort when you want large uploads, timeouts and failover checked against a staging copy. Ask any provider to price each of these items separately.
How long does it take to set up CKAN behind uWSGI and NGINX?
Duration depends on the same drivers as cost, plus how quickly your team can grant access and make decisions, so no timeline is given here. Ask for the schedule in the written scope, where each phase and its dependencies are listed. The phases usually include reviewing the current hosts and network path, configuring uWSGI processes, writing the NGINX site with TLS and upload limits, testing large uploads and timeouts, and documenting the result. Delays most often come from waiting on DNS changes, certificate issuance, change windows for production hosts, and agreement on the upload size. Ask the provider which of these they have assumed and which fall to your team.
What do we need to provide before a CKAN web server project starts?
You need to provide DNS and certificate access, host access, a test upload file and written sign-off on limits. In practice this means:
- Change rights or a change process for the DNS zone that will point to the portal, so the hostname can be created and checked.
- The TLS private key and certificate chain, or access to the certificate authority or ACME account your team uses, plus a named owner for renewal.
- SSH or console access to the CKAN, NGINX and uWSGI hosts, with the sudo rights needed, starting with a staging environment.
- A test file at the largest size you expect users to publish, so limits can be tested from end to end.
- Written sign-off on upload size, timeouts and request body limits, matched to
ckan.max_resource_size.
Confirm change windows and who approves production changes before work starts.
Can our own team set up CKAN behind uWSGI and NGINX without a partner?
Yes, a team with Linux and web server experience can do it, using the official CKAN installation documentation and a staging host that matches production. Start with the official install from source guide, which covers the Python, PostgreSQL, Solr and Redis prerequisites and recommends uWSGI and Nginx for production. Build the web stack on staging first, then run upload tests with a file near your limit, check how long-running requests behave, and confirm the TLS renewal process works before anything goes live. The skills that usually take longest to build in house are NGINX and uWSGI tuning under load and change control around certificates. A partner is most useful when your team lacks the time or those skills.
What does a fixed-scope quote for this work include?
A fixed-scope quote lists the hosts in scope, the components to configure, the deliverables, the test cases and the timeline, all agreed in writing before work starts. Most DeployOpen engagements are fixed-scope, so the quote follows from that written scope, and DeployOpen does not publish a price list. Ask for the hosts and network paths covered, whether uWSGI and NGINX are configured on each host, how TLS and DNS changes are handled, which upload and timeout tests are included, what documentation is delivered, and whether a staging run is part of the work. Also ask what is excluded, such as changes to CKAN extensions, load balancer ownership or post-go-live support, and how a change request is handled if the scope moves.
What recurring work follows a CKAN uWSGI and NGINX setup?
Recurring work covers operating system and package patching, certificate renewal, and retesting after CKAN upgrades. Plan for these as ongoing tasks with named owners. In practice:
- Patching NGINX, uWSGI, Python and the operating system on a schedule your security team approves.
- Renewing certificates before expiry and confirming that the renewal reloads NGINX without an outage.
- Retesting upload limits, timeouts and static asset serving after each CKAN upgrade, including patch releases, so the stack is confirmed to still behave as expected.
Ask whether support will be a retainer or handled by your team, and whether the retest is included. DeployOpen offers ongoing support, upgrades and continuous testing as retainers.
How DeployOpen works on this
DeployOpen treats the CKAN web stack as one unit: uWSGI application processes, NGINX as the TLS reverse proxy, and the upload limits and static asset serving that tie them to CKAN's resource size settings. The work is planned and delivered inside your own cloud accounts, data centers or air-gapped network, and it is documented so your operations team can run it afterward.
How we scope
- A written scope names the uWSGI worker model, NGINX virtual host, TLS termination point and certificate source.
- Scope records the
ckan.max_resource_sizevalue and the matchingclient_max_body_sizesetting, agreed with your data owners. - Fixed-scope engagements agree deliverables and timelines in writing before work starts, with ongoing support available as a retainer.
How we build
- Configure uWSGI processes for CKAN on Python 3.10 or newer, as the source install guide requires.
- Set up NGINX as the TLS reverse proxy, serving static assets and enforcing upload limits verified with test files.
- Verify uWSGI, NGINX and CKAN together, including the Solr and Redis connections the web workers depend on.
How we hand over
- Handover documents each uWSGI, NGINX and TLS setting, the reason for its value, and its file location.
- Runbooks cover restarts, log locations, certificate renewal and how to change the upload limit safely.
- Configuration files are delivered to your team so changes can follow your own review process.
How we support
- Retainers cover upgrades, patch releases and recurring checks on the web stack after handover.
- CKAN's release policy supports only the latest patch of its current and previous minor versions, so plan regular patch windows.
- Changes after handover go into a written scope, so cost and timing stay visible to your team.

