0
votes

I am trying to Deploy Two Django apps with single AWS EC2 Instance having same IP. But it always failed when I have added the second App.sock and test Supervisor. I fond some body asked similar question before. but Not answered properly, and my use case is little different. ( Run multiple django project with nginx and gunicorn )

I have followed these steps: .

  • Cloned my project from Git *

    pip install -r requiernments.txt

    pip3 install gunicorn

    sudo apt-get install nginx -y

    sudo apt-get install supervisor -y

    cd /etc/supervisor/conf.d

    sudo touch testapp2.conf

    sudo nano testapp2.conf

    Updated config file same as below

    [program:gunicorn]

    directory=/home/ubuntu/projects/testapp2/testerapp command=/home/ubuntu/projects/testapp2/venv/bin/gunicorn --workers 3 --bind unix:/home/ubuntu/projects/testapp2/testerapp/app.sock testerapp.wsgi:application autostart=true autorestart=true stderr_logfile=/home/ubuntu/projects/testapp2/log/gunicorn.err.log stdout_logfile=/home/ubuntu/projects/testapp2/log/gunicorn.out.log

    [group:guni]

    programs:gunicorn

    *----------

      sudo supervisorctl reread
    
      sudo supervisorctl update
    
      sudo supervisorctl status
    
  • The below steps will work and Site available on browser if there is only One configuration above. But when i have added an additional configuration, it shows 502 Bad Gateway on the Browser. Please help me to solve this issue.

1

1 Answers

0
votes

You can add one more config file in supervisor conf.d and use different port numbers in the different Django apps.