So I was trying to deploy my python-flask app
on AWS
. I have rented the server and have setup everything. I was using this to do my work of deploying application on AWS server. Up until Step 6 everything was perfect but then as it said in Step 6, I need to add some configurations in default
file inside sites-available
folder in nginx directory
, but in my case I don’t have any sites-available
folder, I am using Amazon Linux AMI
. Can anyone tell me where to add those configurations mentioned in Step 6 or how to create that default file. I even tried to reinstall nginx
but the problem doesn’t solve, no sites-available
folder exists.
2
Answers
Try use Ubuntu linux next time, personally think it is way easier to use.
So
sites-available
folder is in/etc/nginx/
. You can do:sudo vi /etc/nginx/sites-available/default
, if password required, enter root user password.Then input following code:
Then
:wq
Remember to change the PORT if you’re not running flask on 5000.
Then do
ln -s /etc/nginx/sites-available/default /etc/nginx/sites-enabled
.Then do
sudo vi /etc/nginx/nginx.conf
Check if
include /etc/nginx/sites-enabled/*;
is insidehttp{...}
and is not commendedThen
:q
to quitThen do
sudo nginx -s reload
if your nginx is running, or dosudo systemctl start nginx
if it is not running.Then Open http://yourWebsite
For more details for you to understand nginx:
This is not necessary
You can change the
default
to any other name you wantFolder
sites-available
is for the different sites on the serverFolder
sites-enabled
is for the shortcuts of files insites-available
files in
sites-available
will be imported throughinclude /etc/nginx/sites-enabled/*;
intonginx.conf
Look for
include
statements in/etc/nginx/nginx.conf
to find out which files and directories are scanned for configuration snippets. There might be something like this:You can use this to find out which directory is used or just create your own one.