Deploy Django Web App With SSL to VPS with Nginx & Gunicorn | Full Tutorial 2024

แชร์
ฝัง
  • เผยแพร่เมื่อ 14 ต.ค. 2024
  • Welcome to this comprehensive guide on deploying Django applications on an Ubuntu VPS, utilizing Nginx and Gunicorn. This step-by-step tutorial will walk you through the entire process, from setting up your VPS to configuring Nginx and Gunicorn for optimal performance.
    Readme(server config): github.com/The...
    Download putty: www.putty.org/
    Don't forget to like, share, and subscribe for more tutorials on Django, web development, and server administration tips. Let's dive in and deploy Django with confidence!
    ******* Socials *******
    Discord: / discord
    Patreon: / theprotonguy
    Linkedin: / ayodeji-adesola-15392a22b
    Instagram: / the_proton_guy
    Telegram channel: t.me/sO6ZFOaia...
    Twitter: / ayodejiadesola_
    #DjangoDeployment #UbuntuVPS #Nginx #Gunicorn

ความคิดเห็น • 35

  • @caiopjv
    @caiopjv 27 วันที่ผ่านมา +1

    Great video! Thanks a lot. I will try these steps today!

  • @HakiYikio
    @HakiYikio 7 หลายเดือนก่อน

    Same as above, i can finally access my own website with my domain name, thank you :)

    • @the_proton_guy
      @the_proton_guy  7 หลายเดือนก่อน

      You are welcome 🎉

  • @RuslanKhotsenko
    @RuslanKhotsenko 19 วันที่ผ่านมา

    Hello! Thank you very much for this great video!
    I did everything like in the video except of installing SSL. I stuck on ERR_TOO_MANY_REDIRECTS error when I type my domain without pointing a port 8000. If I write down domain name : 8000 everything works correct.
    Where is my error?

    • @the_proton_guy
      @the_proton_guy  19 วันที่ผ่านมา

      Make sure you nginx file is properly setup as in the tutorial, also make sure that your gunicorn command correct:
      gunicorn -bind 0.0.0.0:8000 ProjectName.wsgi

  • @hendahmed5842
    @hendahmed5842 18 วันที่ผ่านมา

    Bro, please reply
    I successfully receive the deployment certificate that implies that my website is secure but it is still not secure when I reload
    Second thing is, why the domain don't work without me running the gunicorn --bind command, Isn't it supposed to work just when you click on it??

    • @the_proton_guy
      @the_proton_guy  18 วันที่ผ่านมา

      Well, you have to run the gunicorn command to run your Django project. Without it, it’s better to run your project with gunicorn in production. Also are you sure your nginx file was setup properly? And did you remember to restart it

  • @johncampilla4146
    @johncampilla4146 5 หลายเดือนก่อน +1

    Thank you for your video! Let me inform you of how i set up my ubuntu, i created a VM in virtual box and acquired the IP address in network settings of virtual box. I followed the instructions that you provided, however in step 4 when creating the virutal environment, i encountered an error message saying "virtualenv: error: argument dest: the destination . is not write-able at /opt". Can you enlighten me on how to solve the issue? Thank you for you prompt response.

    • @the_proton_guy
      @the_proton_guy  5 หลายเดือนก่อน

      So sorry for replying late. The error probably means you don’t have permission to write to that specific directory. Try the following:
      1. First, verify the permissions of the directory where you're trying to create the virtual environment. You can use the ls -ld /opt command to check the permissions of the /opt directory. Ensure that the current user has write permissions to this directory.
      2. Use sudo: If you need to create the virtual environment in a directory that requires elevated permissions, you can use sudo:
      sudo virtualenv /opt/myenv
      3. Adjust Permissions: If you have access to the /opt directory and need to create the virtual environment there, you can adjust the permissions of the directory to allow your user to write to it. You can use the chmod command to modify the permissions:
      sudo chmod u+w /opt
      I hope this helps!

    • @johncampilla4146
      @johncampilla4146 5 หลายเดือนก่อน

      @the_proton_guy, thank you so much. I executed 'sudo chmod u+w /opt' and managed to make progress by creating the virtual environment with the necessary permissions in the '/opt/myproject/' directory. However, at step 5, after successfully entering 'cd /opt/myproject', I ran into an error when trying to execute 'mkdir myproject'. The error message 'mkdir: cannot create directory ‘myproject’: Permission denied' was displayed. It appears there may be an issue with my user credentials since I do not have root access. I apologize for any inconvenience caused by this simple issue, as I am relatively new to LINUX/UBUNTU. I aim to deploy my Django project and test it as if it were a VPS within a virtual machine. Is it feasible to use my VM as a web server, accessible via its IP address and over the internet, solely for testing purposes? Thank you for your assistance; it has helped me understand the issues with Linux, Ubuntu, Nginx, and Gunicorn.

    • @johncampilla4146
      @johncampilla4146 5 หลายเดือนก่อน

      Please let me know if this will be effective, or I will stop setting up the VM. Thank you.

    • @the_proton_guy
      @the_proton_guy  5 หลายเดือนก่อน

      No need to apologize! Linux permissions can be tricky, especially if you're new to working with them. Let's address your questions and concerns one by one:
      1. Permission Denied Error: The error you encountered when trying to create the myproject directory with mkdir indicates that your user does not have the necessary permissions to write to the /opt/myproject directory. Since you used sudo to grant write permissions to the /opt directory, you may also need to use sudo to create the myproject directory:
      sudo mkdir /opt/myproject
      This command should create the directory without any permission errors. After creating the directory, you may also need to adjust its permissions so that your user has full access to it:
      sudo chown -R $USER:$USER /opt/myproject
      This command changes the ownership of the /opt/myproject directory and all its contents to your user, allowing you to write to it without sudo.
      2. Using VM as a Web Server for Testing: Yes, it is feasible to use your VM as a web server for testing purposes. Virtual machines are commonly used for development and testing environments, allowing you to simulate a production environment without affecting your local machine. You can deploy your Django project on the VM, configure Nginx and Gunicorn to serve the application, and access it via its IP address over the internet.However, keep in mind that publicly exposing a server to the internet comes with security considerations. Ensure that you properly secure your VM, apply updates regularly, and follow best practices for web server configuration and application deployment.
      If you need any further assistance, feel free to join my discord server where i am trying to create a community for sharing knowledge and asking questions:
      discord.com/invite/hhqtG4jp

    • @johncampilla4146
      @johncampilla4146 5 หลายเดือนก่อน

      @@the_proton_guy Thank you so much for your assistance, will try later and yes I will join.

  • @MrTR909
    @MrTR909 หลายเดือนก่อน +1

    I can access my server but once i going to log in, error 403 forbidden.

    • @the_proton_guy
      @the_proton_guy  หลายเดือนก่อน

      Okay, you get 403 on the web page? You can access your website from the io address yeah?

  • @HatibuJulius
    @HatibuJulius 5 หลายเดือนก่อน +1

    sir is using supervisor necessary?

    • @the_proton_guy
      @the_proton_guy  5 หลายเดือนก่อน

      Yes

    • @Kevelino-02
      @Kevelino-02 2 หลายเดือนก่อน +1

      ​@@the_proton_guy He talk about supervisor not `super user`

  • @marcofourie5548
    @marcofourie5548 3 หลายเดือนก่อน

    Would this tutorial still work if you don't have a domain just the IP of the VPS? I am struggling to deploy my project!

    • @the_proton_guy
      @the_proton_guy  3 หลายเดือนก่อน +1

      Yeah it will. I broke it down into parts. In the first part, I showed how to deploy to the VPs and access it through the ip address of server. In the second part, I showed how to connect a domain

    • @marcofourie5548
      @marcofourie5548 3 หลายเดือนก่อน

      @@the_proton_guy I already tried to deploy but i want to follow your tutorial. Can install whitenoise in the server terminal on PuTTY and then continue like that?

    • @the_proton_guy
      @the_proton_guy  3 หลายเดือนก่อน +1

      Yes you can.

    • @callofgame2787
      @callofgame2787 หลายเดือนก่อน

      @@the_proton_guy Hi, I followed your instructions and do it 1:1 but once I have set up my domain settings on provider website I can’t access the same files as I can access with typed ip address with port number. I got Nginx welcome page instead of my website when I use domain name :/

    • @the_proton_guy
      @the_proton_guy  หลายเดือนก่อน

      @callofgame2787 hello! Are you sure you configured nginx properly? Text me on Instagram at the_proton_guy

  • @suryabisht00
    @suryabisht00 4 หลายเดือนก่อน

    website is not loading in local browser using server's ip

    • @the_proton_guy
      @the_proton_guy  4 หลายเดือนก่อน

      Check the server logs for errors. What do you see?

    • @suryabisht00
      @suryabisht00 4 หลายเดือนก่อน +1

      @@the_proton_guy where do I see the server log ?

    • @the_proton_guy
      @the_proton_guy  4 หลายเดือนก่อน

      @suryabisht00 check your terminal where your server is running