I want to use nginx as a reverse for apache and gunicorn
location / should be handled by apache
location /webapps/should be handled by gunicorn
upstream gfbu_app_server { server unix:/webapps/gfbu/run/gunicorn.sock fail_timeout=0; } server { listen 80; server_name eu-con.gfbu; client_max_body_size 4G; access_log /webapps/gfbu/logs/nginx-access.log; error_log /webapps/gfbu/logs/nginx-error.log; location /static/ { alias /webapps/gfbu/gfbu/static/; } location /media/ { alias /webapps/gfbu/gfbu/media/; } location /webapps/ { 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://gfbu_app_server; break; } } error_page 500 502 503 504 /500.html; location = 500.html { root /webapps/gfbu/static/; } # everything to apache location / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header Host $host; proxy_pass http://127.0.0.1:8090; } This works kind of, but the request URL for gunicorn is http://<ipaddress>/webapps/ but it has to be / to work.
Gunicorn serves a Django Webapp and it cant match the http://<ipaddress>/webapps/ to any url pattern. Clearly I did something wrong here- comming from Apache and mod_wsgi it was possible to redirect the the request to the specified wsgi_script without the subdir part.
Iam not sure wich part of the nginx -> gunicorn -> django stack is misconfigured - could you help me out?