python - Issues with nginx reverse proxy to an app server running nginx+django -
i have app running on server a. have server b want use reverse proxy accessing app on server a. server running nginx 1.4.5 , django (python 2.7.6 fastcgi), server b running nginx 1.4.5 well. want add on ssl way.
the proxy kinda working. issue requests don't see passed along correctly. when going https://servera.org/ 404 error instead of log-in page i'm expecting.
this error message seeing in browser (it's error message, know request reaching server a):
page not found (404) request method: request url: http://nova.iguw.tuwien.ac.at/index.html using urlconf defined in tubadges.urls, django tried these url patterns, in order: 1. ^admin/doc/ 2. ^admin/ 3. ^$ 4. ^badges/?$ 5. ^badges/(?p<uid>\d+)/?$ 6. ^presets/$ 7. ^svg$ 8. ^bgsvg$ 9.
this config reverse proxy:
upstream server_a { server servera.org:8080 fail_timeout=0; } server { listen 443 ssl; listen 80; server_name subdomain1.serverb.org; server_name subdomain2.serverb.org; keepalive_timeout 70; ssl_certificate /etc/certificates/server_b.pem; ssl_certificate_key /etc/certificates/server_b.key; error_log /var/log/nginx/aurora.ssl.error.log error; access_log off; client_max_body_size 50m; location ~ ^/(.+)$ { proxy_intercept_errors off; proxy_buffering off; proxy_connect_timeout 5; proxy_send_timeout 5; proxy_read_timeout 5; proxy_set_header host $host; proxy_set_header x-forwarded-by $server_addr:$server_port; proxy_set_header x-forwarded-fo $remote_addr; proxy_set_header x-forwarded-proto $scheme; proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; access_log off; error_log /var/log/nginx/tubadges.error.log debug; proxy_pass http://server_a; proxy_redirect off; } }
and config i'm using on server run app:
server { listen 8080; ## listen ipv4 server_name localhost; server_name servera.org; client_max_body_size 5m; error_log /var/log/nginx/app1.error.log; access_log /var/log/nginx/app1.access.log; location /static { root /srv/django/projects/app1; } location /media { root /srv/django/projects/app1; } location / { # host , port fastcgi server fastcgi_pass unix:/srv/django/run/app1.socket; fastcgi_param path_info $fastcgi_script_name; fastcgi_param request_method $request_method; fastcgi_param query_string $query_string; fastcgi_param content_type $content_type; fastcgi_param content_length $content_length; fastcgi_param server_addr $server_addr; fastcgi_param server_port $server_port; fastcgi_param server_name $server_name; fastcgi_param server_protocol $server_protocol; fastcgi_param remote_addr $remote_addr; fastcgi_pass_header authorization; fastcgi_intercept_errors off; } }
i'm assuming it's got django app config or config on server a.
can spot error? need more information?
there, maybe, answer on here have missed?
thanks in advance!
p.s.: first time asking question on stackoverflow, if there's way can improve question better answers, , see bugs, please don't hesitate point out me how can improve question. :)
actually, looks nginx correctly passing request through - error page comes django (so request being serviced apache) , states url:
http://nova.iguw.tuwien.ac.at/index.html
cannot resolved of urls defined in tubadges.urls
you need hit url such http://nova.iguw.tuwien.ac.at/admin/login or that.
Comments
Post a Comment