Reputation: 31
We created one web app in flask, and for users authentication we used the aws cognito hosted UI, and I am able to successfully run the app on my localhost.
But when I tried to deploy it on ec2 ubuntu using nginx server, I can only access the cognito hosted UI of my app, but after successful authentication in cognito, it is supposed to redirect to my dashboard page, which is happening when i am running the code on localhost, but on ec2 instance it says ERR_CONNECTION_REFUSED.
I tried below things:
I tried to run my project with below commands:
sudo systemctl stop project_name
sudo systemctl restart project_name
sudo systemctl daemon-reload
sudo systemctl start project_name
sudo systemctl enable project_name
sudo systemctl start nginx
sudo systemctl enable nginx
sudo systemctl restart nginx
Any guidance would be very helpful.
Upvotes: 0
Views: 625
Reputation: 75
I know this is old, but I ran into this issue and it took me a while to solve. Just wanted to add this here for posterity.
All you need to do is delete the line
try_files $uri $uri/ =404:
in the sites-available/default file.
Upvotes: 0
Reputation: 80
Try running the app by passing the host like this in your app
if __name__ == '__main__':
app.run(host='0.0.0.0')
Upvotes: 1