I'm trying to run my django app with nginx, but when trying to connect to my EC2 IP im getting "connection timed out" error. It properly shows django "deafult" page on terminal when I run
curl 127.0.0.1
But no luck with EC2 IPs. Public IP gives me error 99 (cannot assign to requested address), private IP gives me "connection timed out" message in my browser.
So what's wrong with me and/or this nginx config:
user nobody nogroup;
pid /var/run/nginx.pid;
error_log /var/log/nginx/error.log;
events {
worker_connections 1024;
accept_mutex: on;
}
http {
include mime.types;
default_type application/octet-stream;
access_log /tmp/nginx.access.log combined;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
gzip on;
gzip_http_version 1.0;
gzip_proxied any;
gzip_min_lenght 500;
gzip_disable "MSIE [1-6]\.";
gzip_types text/plain text/xml text/css
text/comma-separated-values
text/javascript application/x-javascript
application/atom+xml;
include /etc/nginx/sites-enabled/*;
}
Here's my enabled site
upstream app_server {
server 127.0.0.1:8000 fail_timeout=0;
}
server {
listen my_IP:80 default;
client_max_body_size 4G;
server_name www.my_domain.pl my_domain.pl;
keepalive_timeout 5;
root /home/ubuntu/webapps/my_app;
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
if (!-f $request_filename) {
proxy_pass http://app_server;
break;
}
}
error_page 500 502 503 504 /500.html;
location = /500.html {
root /path/to/app/current/public;
Do I need to change the last line for something else? Or this proxy_pass thingy?