Translate

Views

Sunday, November 3, 2024

Deploy django project use nginx on vm azure

Step1: SSH to vm on CLI azure


Step2: Install nginx and config


sudo touch /etc/nginx/sites-available/20.2.90.6.conf

nano  /etc/nginx/sites-available/20.2.90.6.conf


server {

  server_name 20.2.90.6;

    location / {

    proxy_pass http://localhost:8000;

    proxy_http_version 1.1;

    proxy_set_header Upgrade $http_upgrade;

    proxy_set_header Connection 'upgrade';

    proxy_set_header Host $host;

    proxy_cache_bypass $http_upgrade;

  }

}


sudo ln -s /etc/nginx/sites-available/20.2.90.6.conf /etc/nginx/sites-enabled/20.2.90.6.conf


Step 3: Run django server

python manage.py runserver


No comments: