Skip to content

Instantly share code, notes, and snippets.

@manjurulhoque
Created April 14, 2021 13:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save manjurulhoque/3387c61b8cc9bb6c5e82fe01e13e9e9c to your computer and use it in GitHub Desktop.
Save manjurulhoque/3387c61b8cc9bb6c5e82fe01e13e9e9c to your computer and use it in GitHub Desktop.
ssh into the server and goto the directory
then create a folder using mkdir, cd into that folder. create virtualenv and activate that env
clone project using git and goto the project directory. install dependencies using pip install -r requirements.txt.
create service file sudo nano /etc/systemd/system/<name>.service and configure like below:
[Unit]
Description=gunicorn daemon for listen music project
After=network.target
[Service]
User=root
Group=www-data
WorkingDirectory=/var/www/html/listenproject/listenapp
ExecStart=/var/www/html/listenproject/venv/bin/gunicorn --access-logfile - --workers 3 --bind unix:/var/www/html/listenproject/listenapp.sock music.wsgi:application
[Install]
WantedBy=multi-user.target
then run this commands to start and enable this service:
# listenapp is just service name
sudo systemctl start listenapp
sudo systemctl enable listenapp
add domain config to /etc/nginx/sites-enabled/default
sudo nginx -t
sudo systemctl restart nginx
to reload after editing any service file:
sudo systemctl daemon-reload
sudo systemctl restart gunicorn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment