Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

-1
I’ve been trying to deploy two Django projects on a single server using uWSGI and Unix socket NGINX, I’ve cross-checked the configuration it seems fine, but it behaves oddly. Let me give the project names A for first and B for second for better understanding and referencing.
For both projects, I’ve set up uWSGI and Nginx setup as per this excellent article How To Serve Multiple Django Applications with uWSGI and Nginx in Ubuntu 20.04
Everything is working right emperor.uwsgi.service shows two uwsgi processes for each project A and B there are socket files at the correct path, but when I tried to serve both with the different subdomain, let’s say for A subdomain A.example.com and B subdomain B.example.com at port 80 using Nginx then A.example.com works fine, but B.example.com returns default Nginx page, but if I change the B.example.com’s config and use port 8000 then it works fine at B.example.com:8000.
A.conf symlinked to /etc/nginx/sites-enabled/A from /home/ubuntu/ProjA/nginx/A.conf
upstream A_uwsgi {
server unix:///run/uwsgi/A.sock fail_timeout=0;
}
# configuration of the server
server {
# the port your site will be served on
listen 80;
# the domain name it will serve for
server_name A.example.com;
# charset utf-8;
# max upload size
client_max_body_size 5M;
access_log /home/ubuntu/ProjA/logs/nginx-access.log;
error_log /home/ubuntu/ProjA/logs/nginx-error.log;
# conf for letsencrypt ssl
include /home/ubuntu/ProjA/nginx/letsencrypt.conf;
# Not using since handled via google static storage
# Django media
location /media {
alias /home/ubuntu/ProjA/media;
}
location /static {
alias /home/ubuntu/ProjA/static;
}
# non-media requests handled by uwsgi
location / {
include /home/ubuntu/ProjA/uwsgi/uwsgi_params; # the uwsgi_params file you installed
uwsgi_pass A_uwsgi;
}
}
B.conf symlinked to /etc/nginx/sites-enabled/B from /home/ubuntu/ProjB/nginx/B.conf
upstream B_uwsgi {
server unix:///run/uwsgi/B.sock fail_timeout=0;
}
# configuration of the server
server {
# the port your site will be served on
listen 80;
# the domain name it will serve for
server_name B.example.com;
# charset utf-8;
# max upload size
client_max_body_size 5M;
access_log /home/ubuntu/ProjB/logs/nginx-access.log;
error_log /home/ubuntu/ProjB/logs/nginx-error.log;
# conf for letsencrypt ssl
include /home/ubuntu/ProjB/nginx/letsencrypt.conf;
# Not using since handled via google static storage
# Django media
location /media {
alias /home/ubuntu/ProjB/media;
}
location /static {
alias /home/ubuntu/ProjB/static;
}
# non-media requests handled by uwsgi
location / {
include /home/ubuntu/ProjB/uwsgi/uwsgi_params; # the uwsgi_params file you installed
uwsgi_pass B_uwsgi;
}
}
So as per the above config, the site A.example.com works like a charm but not B.example.com.
but if I change the listen port in B.conf
...
server {
# the port your site will be served on
listen 8000;
# the domain name it will serve for
server_name B.example.com;
...
then it works on B.example.com:8000
I went through many articles but did not able to achieve what I want. Maybe there is something I missed. I tried this several times on several servers manually and automated scripts but pulled by the same behavior.
ebeecroft
68aa2215160846bca0a00f952c5fdc
009fd274aeae48f2bfbda6ef568676
Cloudstream Apk
032f50ee7f7d489db3b05e204fe139
032f50ee7f7d489db3b05e204fe139
Edward Sitarski
ebeecroft
dashan
34bcef38725b4e6eb5224ae028f17e