Deploy Django project with Nginx, and Gunicorn on Ubuntu 22.04 | #django #nginx #gunicorn #ubuntu

preview_player
Показать описание
Howdy Programers,
-------------------------------------------------------------

Creating systemd Socket and Service Files for Gunicorn

paste below code:

[Unit]
Description=gunicorn socket

[Socket]

[Install]

-------------------------------------------------------------

paste below code::

[Unit]
Description=gunicorn daemon

[Service]
User=sammy
Group=www-data
WorkingDirectory=/home/sammy/myprojectdir
ExecStart=/home/sammy/myprojectdir/myprojectenv/bin/gunicorn \
--access-logfile - \
--workers 3 \

[Install]

-------------------------------------------------------------

-------------------------------------------------------------

Configure Nginx to Proxy Pass to Gunicorn

sudo nano /etc/nginx/sites-available/myproject
paste below code:

server {
listen 80;
server_name server_domain_or_IP;

location /static/ {
root /home/sammy/myprojectdir;
}

location / {
include proxy_params;
}
}

sudo ln -s /etc/nginx/sites-available/myproject /etc/nginx/sites-enabled

-------------------------------------------------------------
Thank you
Regards
Official Tech
--------------------------------------------------------------

Рекомендации по теме
Комментарии
Автор

I spent almost 7 hours on this, and i finally did it in 30 minutes with your video. Thanks you very very very much!

dn
Автор

Really good explanation, works very well! ;)

ushared-a-chregion
Автор

After searching and watching millions of videos with Hindus you solved my problem which was not solved for the 3rd day. Respect!

_friendly_angel
Автор

Thank you, it saved my hours of time.

phpkishorekishore
Автор

Thx for tutorial. One question, are you copying from the clipboard default nginx configuration text? Or some assistant do this? Because the most important part that connects the gunicorn socket with nginx is not explained. THX!

DmitryLaierCrypto
Автор

Thank you, it helped a lot, do you have another video showing it and putting it on https?

multimilmobr
Автор

So what are the steps if I have my finished project on local disk. Should I copy and paste all files to server, what about requirments.txt and so on ...

tornjak
Автор

hello great content but how can I configure the nginx to serve two Django apps in my ec2 instance on different ports using the public IP of the instance as server name

chrisowuor
Автор

please can you make a video on how we can deployit with docker?

alexdin
Автор

But if you created an apiview, could I consume it? implemented this way of deploying

sebastiansebastiana
Автор

great video! my static files are not still loaded not sure why

chimaezeorah
Автор

should i develop every django project in /var/www/html/... my django project?

ahmadumar