EC2 deploy DJango application | NGINX | Supervisor | Gunicorn
11.1 هزار بار بازدید -
4 سال پیش
-
I am making a series
I am making a series of videos available to you to learn Amazon Web services and in this session we are going to talk about deploying Django application on AWS EC2 instance.
Note: Here my django application name is "welcome"
Required packages:
sudo apt-get update
sudo apt-get install python3-pip -y
sudo pip3 install gunicorn -y
sudo apt-get install supervisor
sudo apt-get install nginx -y
sudo pip3 install django
Supervisor configuration:
sudo vi /etc/supervisor/config.d/gunicorn.conf
[program:gunicorn]
directory=/home/ubuntu/welcome
command=/usr/local/bin/gunicorn --workers 3 --bind unix:/home/ubuntu/welco
me/app.sock welcome.wsgi:application
autostart=true
autorestart=true
stderr_logfile=gunicorn.err.log
stdout_logfile=gunicorn.out.log
[group:guni]
programs:gunicorn
Verify Supervisor configuration:
sudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl status
NGINX configuration changes:
sudo vi /etc/nginx/sites-available/django.conf
server{
listen 80;
server_name ec2-54-221-184-166.compute-1.amazonaws.com;
location / {
include proxy_params;
proxy_pass http://unix:/home/ubuntu/welcome/app.sock;
}
}
Verify NGINX config changes and restart server:
sudo nginx -t
sudo ln django.conf /etc/nginx/sites-enabled
sudo service nginx restart
AWS Complete tutorial - AWS Cloud EC2 introduction
Note: Here my django application name is "welcome"
Required packages:
sudo apt-get update
sudo apt-get install python3-pip -y
sudo pip3 install gunicorn -y
sudo apt-get install supervisor
sudo apt-get install nginx -y
sudo pip3 install django
Supervisor configuration:
sudo vi /etc/supervisor/config.d/gunicorn.conf
[program:gunicorn]
directory=/home/ubuntu/welcome
command=/usr/local/bin/gunicorn --workers 3 --bind unix:/home/ubuntu/welco
me/app.sock welcome.wsgi:application
autostart=true
autorestart=true
stderr_logfile=gunicorn.err.log
stdout_logfile=gunicorn.out.log
[group:guni]
programs:gunicorn
Verify Supervisor configuration:
sudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl status
NGINX configuration changes:
sudo vi /etc/nginx/sites-available/django.conf
server{
listen 80;
server_name ec2-54-221-184-166.compute-1.amazonaws.com;
location / {
include proxy_params;
proxy_pass http://unix:/home/ubuntu/welcome/app.sock;
}
}
Verify NGINX config changes and restart server:
sudo nginx -t
sudo ln django.conf /etc/nginx/sites-enabled
sudo service nginx restart
AWS Complete tutorial - AWS Cloud EC2 introduction
4 سال پیش
در تاریخ 1399/03/29 منتشر شده
است.
11,103
بـار بازدید شده