server

How I create multiple django site for subdomain1 and subdomain2, using gunicorn + nginx + systemd | ubuntu 20.04 | DigitalOcean

Prerequisite:

1.Can run gunicorn on your env

gunicorn --bind 0.0.0.0:9001 myapp.wsgi
2.Added subdomain on droplet networking. 3.Root access. 4.Install certbot nginx
sudo apt install certbot python3-certbot-nginx
.

Create multiple django site for subdomain1 and subdomain2, using gunicorn + nginx + systemd | DigitalOcean.

1.Make sure you already installed the gunicorn on your django env

pip install gunicorn

2.Create new socket file on

sudo nano /etc/systemd/system/gunicorn_subdomain1.socket

Linux CentOs LAMP

Install update

$ sudo yum update

Install apache

Install apache

$ sudo yum install httpd

Start apache

$ sudo systemctl start httpd.service

Set apache to start on boot

$ sudo systemctl enable httpd.service

Set firewall

$ sudo firewall-cmd --add-service=http --permanent

Install MySQL

Install MySQL

$ sudo yum install mariadb-server mariadb

Start MySQL

$ sudo systemctl start mariadb

Set MySQL to start on boot

Drush export/import database

Drupal 6 and 7

$ drush cc
$ drush sql-dump > ~/my-sql-dump-file-name.sql

Drupal 8

$ drush cr
$ drush sql-dump > ~/my-sql-dump-file-name.sql

Download Database from the server

$ scp username@example.com:~/my-sql-dump-file-name.sql ~/projects

Import Database

$ drush sql-drop
$ drush sql-cli < ~/my-sql-dump-file-name.sql