You can host several independent Django sites on one Linux server by running one public Nginx instance, creating one Nginx server block per domain, and sending each block to that site’s own Gunicorn service through a private Unix socket or loopback TCP port. Keep every project’s code, virtual environment, settings, secrets, database credentials, logs, and process identity separate. That arrangement lets you deploy or restart one site without taking the others offline.
Antihost offers Linux VPS plans with full root access, unlimited traffic on a 1 Gbps port and a 14-day free trial.
The reliable order is DNS and host preparation, per-site Django setup, one Gunicorn service or socket per site, Nginx routing and TLS, then verification with Django’s deployment checks and domain-by-domain smoke tests.
As an Amazon Associate I earn from qualifying purchases.
What the finished architecture looks like
Nginx is the only public application entry point. It listens on ports 80 and 443, examines the incoming Host header, and chooses the matching virtual host. Each virtual host handles that domain’s static and media files locally and proxies dynamic requests to the corresponding Gunicorn endpoint.
| Layer | Responsibility | Isolation rule |
|---|---|---|
| DNS | Points each hostname to the server’s address. | Every public hostname must resolve to the intended host. |
| Nginx | Terminates TLS, redirects HTTP, serves files, and routes requests. | One explicit server block and upstream target per domain. |
| Gunicorn | Runs a Django WSGI application. | One service, environment, log path, and socket or port per project. |
| Django | Applies site settings, authentication, database access, and application logic. | Separate settings, secrets, database credentials, and virtual environment. |
For example, site1.example can proxy to /run/site1-gunicorn.sock, while site2.example proxies to /run/site2-gunicorn.sock. A request for one hostname never needs to traverse the other project’s process.
#1 Best Overall
- Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
- Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
- Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
- Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
- 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
Request flow
- A DNS record sends the domain to the server.
- Nginx receives the request and selects a
serverblock by theHostheader. - The selected block serves that site’s
/static/and/media/paths from its own directories. - Requests that are not files are proxied to that site’s Gunicorn socket or loopback port.
- Gunicorn loads the site’s WSGI module and returns the response through Nginx.
Pass Host, X-Real-IP, X-Forwarded-For, and X-Forwarded-Proto. Django and Gunicorn need the forwarded protocol information to construct secure URLs correctly when Nginx terminates TLS. If Nginx is on a different host, restrict trusted forwarded-proxy addresses rather than trusting arbitrary clients.
Plan the host before adding projects
Prepare DNS, firewall, and identities
- Create an address record for every domain and wait for it to resolve to the server before final testing.
- Allow inbound TCP 80 and 443 at the firewall. Keep Gunicorn sockets and loopback ports private.
- Use a dedicated Linux user or service identity for each project where practical. At minimum, ensure that a service cannot write to another site’s code, secrets, uploads, or logs.
- Install Nginx, Python, virtual-environment tooling, and systemd-managed service support from your distribution’s supported packages.
Use a predictable per-site layout
The names are examples; choose paths that fit your distribution and backup policy. Do not copy them without checking ownership and permissions.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →/srv/site1/app/ # project root
/srv/site1/venv/ # site1 virtual environment
/srv/site1/env # secrets and production settings
/srv/site1/static/ # STATIC_ROOT after collectstatic
/srv/site1/media/ # user uploads
/var/log/site1/ # application and service logs
/run/site1-gunicorn.sock # private runtime socket
/srv/site2/app/
/srv/site2/venv/
/srv/site2/env
/srv/site2/static/
/srv/site2/media/
/var/log/site2/
/run/site2-gunicorn.sock
Keep each site’s settings module, database credentials, email configuration, cache settings, and log destinations in its own environment file. Store that file outside version control with permissions that allow only the relevant service identity to read it.
Build and validate each Django project
Create the environment and install pinned dependencies
Repeat this process for every site. Pin dependencies in a requirements file or equivalent lock mechanism so a deployment does not silently select incompatible versions.
cd /srv/site1/app
python3 -m venv /srv/site1/venv
/srv/site1/venv/bin/pip install --upgrade pip
/srv/site1/venv/bin/pip install -r requirements.txt
Run the equivalent commands under the second project’s directory and virtual environment. The Gunicorn executable used by systemd must come from that site’s virtual environment; using a global executable can load the wrong Django or dependency versions.
Set production Django values
Set DEBUG = False. Include every legitimate hostname for the site in ALLOWED_HOSTS; Django requires this when debugging is disabled and uses it to reduce Host-header attacks. Keep SECRET_KEY, database passwords, email credentials, and other secrets in the service environment rather than source control.
Rank #2
- 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
- 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
- Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
- 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
- What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
Define a site-specific STATIC_ROOT, run migrations against the production database, and collect static assets:
cd /srv/site1/app
/srv/site1/venv/bin/python manage.py migrate --settings=config.settings.production
/srv/site1/venv/bin/python manage.py collectstatic --noinput --settings=config.settings.production
/srv/site1/venv/bin/python manage.py check --deploy --settings=config.settings.production
Use the corresponding settings module and paths for each project. Configure production cache, email, database connection pooling, and logging deliberately; development defaults are not a substitute for a production configuration.
Make HTTPS behavior consistent
Any site with authentication should enforce HTTPS across the site. Login credentials, session cookies, and password-reset tokens are access credentials and must not travel over cleartext HTTP. When TLS terminates at Nginx, pass X-Forwarded-Proto and configure Django’s trusted proxy and secure-cookie settings to recognize the original HTTPS request. Apply HTTP-to-HTTPS redirects in exactly one intended layer to avoid redirect loops.
Run one Gunicorn service per site
Gunicorn’s deployment guidance strongly recommends placing it behind a proxy. A separate service per project gives independent restarts, deployments, resource accounting, and failure boundaries. Name units clearly, such as site1-gunicorn.service and site2-gunicorn.service.
Service-unit pattern
A service unit should identify the project directory, the virtual-environment executable, the WSGI module, and the environment file. This illustrative unit uses a private Unix socket; adjust the user, group, module, and paths for your host.
[Unit]
Description=Gunicorn for site1
After=network.target
[Service]
Type=notify
User=site1
Group=site1
WorkingDirectory=/srv/site1/app
EnvironmentFile=/srv/site1/env
ExecStart=/srv/site1/venv/bin/gunicorn
--workers 3
--bind unix:/run/site1-gunicorn.sock
config.wsgi:application
Restart=on-failure
[Install]
WantedBy=multi-user.target
The worker count in this example is not a universal recommendation. The cited deployment documentation does not provide one formula or benchmark that fits every multi-site workload. Size workers against available memory, request characteristics, database capacity, and observed latency, then monitor before increasing them.
Rank #3
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
Socket activation option
With socket activation, systemd owns the listening socket and starts Gunicorn when needed. Create a matching socket unit for each site, with a unique path and permissions that allow the Nginx worker account to connect:
[Unit]
Description=Socket for site1 Gunicorn
[Socket]
ListenStream=/run/site1-gunicorn.sock
SocketUser=site1
SocketGroup=www-data
SocketMode=0660
[Install]
WantedBy=sockets.target
Use the service’s expected activation settings and the Gunicorn version supported by your distribution. The important properties are a unique socket path, a deliberate socket owner and group, and a mode that does not expose the application to unrelated users.
Enable and test the unit
sudo systemctl daemon-reload
sudo systemctl enable --now site1-gunicorn.service
sudo systemctl status site1-gunicorn.service
sudo ls -l /run/site1-gunicorn.sock
If you use a socket unit, enable the socket instead of (or as required by) the service arrangement. Test locally before changing DNS or opening the site publicly. A Unix-socket request can be made from the Nginx account, for example:
sudo -u www-data curl --unix-socket /run/site1-gunicorn.sock
-H 'Host: site1.example' http://localhost/
Replace www-data with the account used by your Nginx workers. A successful response proves that the WSGI process starts and that the socket permissions permit the intended client.
Unix sockets or loopback TCP ports?
Both designs keep Gunicorn off the public network. Pick one consistently per site and document the choice.
| Criterion | Unix socket | Loopback TCP port |
|---|---|---|
| Permission management | Requires correct owner, group, and mode on the socket. | Relies primarily on binding to loopback and host firewall policy. |
| Observability | Socket existence and filesystem metadata reveal basic health. | Local tools can inspect a numbered listening port. |
| Portability | Convenient when Nginx and Gunicorn share one host. | Often simpler when service tooling expects TCP endpoints. |
| Cross-host support | Not suitable when proxy and application are on different hosts. | Can support a separate application host when network controls and trusted proxies are configured. |
| Failure diagnosis | Check path existence, ownership, mode, and service logs. | Check the listener, port collision, bind address, and local connectivity. |
Do not bind a production Gunicorn process to a public interface when Nginx is intended to be the entry point. A public bind bypasses the routing, TLS, header, and access controls you configured in Nginx.
Free tools Windows power users keep installed
One-click scans. No signup required.
Rank #4
- Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
- Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
- Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
- Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
- Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
Configure Nginx for multiple domains
Reject unknown Host headers
Create a default server that does not accidentally serve one customer’s site for an unknown hostname. Django’s deployment guidance gives a 444 example for Nginx; use the response behavior that fits your security and monitoring policy.
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
return 444;
}
server {
listen 443 ssl default_server;
listen [::]:443 ssl default_server;
server_name _;
return 444;
}
Configure a certificate appropriate for the default TLS listener on systems that require one before Nginx can accept the connection. The exact certificate management method depends on your operating system and certificate authority.
Create one HTTP block per domain
Each block must name only its own hostnames, files, and upstream endpoint. This example redirects HTTP and assumes certificates are configured in the HTTPS block.
server {
listen 80;
listen [::]:80;
server_name site1.example www.site1.example;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name site1.example www.site1.example;
ssl_certificate /etc/letsencrypt/live/site1.example/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/site1.example/privkey.pem;
location /static/ {
alias /srv/site1/static/;
}
location /media/ {
alias /srv/site1/media/;
}
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://unix:/run/site1-gunicorn.sock:;
}
}
Copy the pattern for site2.example, changing every domain, certificate path, static directory, media directory, and socket or port. A mismatch in any one of those values can send a request to the wrong project or produce missing files.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Fix the driver behind crashes, sound loss and screen glitches3Repair Windows errors before they cause bigger problemsStatic and media file details
Django writes collected assets to STATIC_ROOT; Nginx should serve that directory directly. User uploads belong in the site’s own media directory. Verify that the Nginx worker can traverse parent directories and read files, while upload directories remain writable only by the intended application or deployment identity. Never point a site’s alias at another project’s directory.
Forwarding and buffering
Keep the forwarded headers shown above in every dynamic location. Proxy buffering can affect synchronous Gunicorn workers, so choose buffering settings based on response size and workload instead of copying a blanket value. If a site streams responses or uses long-running requests, test those paths separately and set appropriate proxy timeouts.
Best Value
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
Validate and reload safely
sudo nginx -t
sudo systemctl reload nginx
Never reload after a failed syntax test. After a successful reload, test each hostname over HTTPS, check a known static file, exercise a dynamic page, and inspect Nginx and Gunicorn logs for the same request.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.A deployment sequence that limits surprises
- Provision the host. Install supported packages, create service identities, configure firewall rules, and create DNS records.
- Prepare each project. Create its directory tree and virtual environment, install pinned dependencies, and verify the WSGI module imports under that environment.
- Set production configuration. Load secrets from a protected environment file, set
DEBUG = FalseandALLOWED_HOSTS, configure the database and cache, then run migrations andcollectstatic. - Run Django’s gate. Execute
python manage.py check --deploy --settings=<production_settings>for every site and resolve warnings before release. - Add Gunicorn units. Create a service or socket for each project, use unique endpoints, enable it at boot, and test locally through the socket or loopback port.
- Add Nginx blocks. Configure the default rejecting server, one block per domain, static/media locations, forwarded headers, and the matching upstream.
- Validate Nginx. Run
nginx -t, then perform a controlled reload. - Enable TLS. Install a certificate for every public domain, enable HTTP-to-HTTPS redirects, and verify that Django sees the original HTTPS scheme.
- Smoke-test every hostname. Check an anonymous page, a static asset, a media asset where applicable, a login flow where applicable, and a representative application action.
- Test isolation. Restart one Gunicorn service and confirm the other domain remains available; review logs and monitoring alerts.
Common failures and precise fixes
| Symptom | Likely causes | Checks and fixes |
|---|---|---|
| 502 Bad Gateway | Gunicorn is stopped, the endpoint is absent, Nginx cannot access it, or the WSGI module fails under the site’s virtual environment. | Check systemctl status and the service journal, verify the socket or port, test as the Nginx account, and run the WSGI command with the same working directory and environment. |
| Wrong site appears | DNS points elsewhere, server_name is too broad, the default server catches the request, or the upstream path belongs to another project. |
Inspect DNS, send a request with the intended Host header, review the selected block, and compare every upstream and filesystem path. |
| Static files return 404 | STATIC_ROOT is wrong, collectstatic was not run, or Nginx cannot read the directory. |
Run collectstatic with production settings, confirm the file exists under the configured alias, and fix traversal and read permissions. |
| Redirect loop or insecure links | The forwarded protocol header is missing, Django does not trust the proxy, or more than one layer is forcing redirects. | Pass X-Forwarded-Proto, configure Django’s proxy-SSL settings consistently, and leave one deliberate TLS-redirect path. |
| Permission denied on socket | The socket user, group, or mode does not permit the Nginx worker to connect. | Compare socket metadata with the Nginx worker account, set the systemd socket’s owner/group/mode deliberately, restart the unit, and retest locally. |
| One site affects another | Shared service state, overlapping paths, common environment files, or host memory pressure. | Separate services and logs, verify unique paths and settings, account for each process’s memory, and monitor resource use during deployments. |
Operating several sites over time
Deploy independently
Each project should have its own release procedure: install dependencies into its environment, run migrations deliberately, collect static assets, restart only its Gunicorn unit, and then smoke-test its domain. Nginx normally needs a reload only when routing, certificates, or proxy settings change.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minutePC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Monitor the boundaries
Track the health of every service separately: systemd state, restart count, socket or port presence, response status, latency, and memory consumption. Give logs site-specific names or directories so a failure can be traced without mixing requests from different applications.
Plan resource limits from evidence
Multiple Django projects compete for CPU, memory, database connections, and disk I/O. There is no single worker-count formula that applies to every combination of sites. Start conservatively, measure queueing and latency, and account for the memory cost of each Gunicorn worker before increasing concurrency. If one application routinely exhausts the host, move it to a separate host or adjust its resource policy rather than allowing it to destabilize unrelated sites.
Back up per-site state
Back up each database, environment configuration, uploaded media, and deployment metadata independently. Test restoration for one project without overwriting another project’s data. Keep certificates and renewal configuration accounted for in the host’s recovery plan.
Release checklist
- DNS for every hostname resolves to the intended server.
- Only Nginx is publicly reachable on ports 80 and 443.
- Every domain has one explicit Nginx server block and its own certificate.
- Unknown Host headers are rejected by the default server.
- Every site has a separate project root, virtual environment, environment file, database credentials, logs, Gunicorn unit, and endpoint.
- Static and media aliases point only to that site’s directories.
- Gunicorn receives the correct WSGI module and starts under the intended virtual environment.
- Socket ownership or loopback binding allows Nginx to connect but does not expose Gunicorn publicly.
ALLOWED_HOSTS, secure cookies, proxy-SSL settings, and HTTPS redirects match the public domains.check --deploy,nginx -t, local upstream tests, and per-domain HTTPS smoke checks all pass.- Restarting or deploying one site leaves the others available.
This design keeps routing simple while preserving operational boundaries: Nginx decides which domain is being requested, and each domain reaches only its matching Django process and files.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREEClear 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.




