
The file will look like this after adding the necessary configuration and keep the rest of file as same. There is a config file named default in / etc/nginx/sites-enabled/ that has a basic setup for NGINX, we will edit this file.
#APACHE WSGI DJANGO AWS POSTGRESQL INSTALL#
To install Nginx run the command sudo apt install nginx Run the following so that the model migrations take place and all the static files will be collected to a common folder ( path given in STATIC_ROOT ) manage.py makemigrations manage.py migrate manage.py collectstatic Put your secret keys and passwords in environment variablesīASE_DIR=os.path.dirname(os.path.dirname(os.path.abspath(_file_))) STATIC_ROOT = os.path.join(BASE_DIR, “static”).We have to make some changes to the settings.py in our project This will clone the repository to the folder and next time we can just pull the changes using git pull Go to the newly created folder ( /home/ubuntu/Project/ProjectName/ ).Make sure that you have your code in a repository so that we can pull the code into our ec2 instance easily. Now we will place our code in the following path /home/ubuntu/Project/ProjectName

Now that we have installed our dependencies we can create a folder in which we will copy our django app cd /home/ubuntu/ mkdir Project cd Project mkdir ProjectName cd ProjectName Install python, pip and django sudo apt install python sudo apt install python3-pip pip3 install django The worker MPM handles each request in a separate thread, which makes it much more suitable for use on a VPS than the.

The event MPM might give higher performance, but is far less often used, and any performance improvement is minimal - hence I won't recommend it.

We can connect to an instance using 'connect' option in console ( or using putty or any other similar tool ).Once connected run the following sudo apt-get update The worker MPM would be your best choice. Review and Launch your instance, it may take some time for the instance to start running. Now configure security groups and open ports 80 since we will be using those ports.
