django - Configuring NGINX for correct URL forwarding to Graphite docker image -


i have web application running on debian through nginx , uwsgi. we've begun using graphite , statsd running in docker container collect stats on application (from https://github.com/hopsoft/docker-graphite-statsd). docker container has own nginx serve graphite. running docker container forwarding port 8081 80 , able access graphite through http:// example.com:8081.

i trying route web traffic graphite through our existing nginx server able use our established authentication method when accessing it.

i able access graphite via example.com/graphite/ , have associated content referred under directory.

currently example.com/graphite/ forwards http:// example.com:8091/graphite/. url not appear change. there, graphite loads up, page elements load :8091/, e.g. http:// example.com:8091/content/js/ext/resources/images/default/sizer/s-handle.gif, whereas referred via http:// example.com/graphite/content/js/ext/resources/images/default/sizer/s-handle.gif.

when go domain.com/graphite/admin/ receive our web application's 404 page. html admin page has loaded successfully, receive 404s https:// example.com/browser/header/ , https:// example.com/composer/?.

here relevant sections of current nginx.conf:

# https server server {     listen                    443;     listen                    8000;     server_name               $hostname;     ssl                       on;     etag                      on;  # used in tests       ssl_verify_client         optional;     ssl_verify_depth          2;       location /graphite {         rewrite                 ^/graphite(/.*)$ $1 break;         proxy_pass              http://localhost:8091;         proxy_set_header        host $host;         proxy_redirect http://127.0.0.1:8091/graphite/ http://$host/graphite/;     }      location /graphite/admin {         rewrite                 ^/graphite(/.*)$ $1 break;         proxy_pass              http://localhost:8091;         proxy_set_header        host $host;         proxy_redirect http://127.0.0.1:8091/graphite/ http://$host/graphite/;     }      location / {         uwsgi_pass              unix:///tmp/web2py.socket;         include                 uwsgi_params;          uwsgi_param             ssl_client_id       $ssl_client_s_dn;         uwsgi_param             remote_user         $ssl_client_s_dn;         uwsgi_param             uwsgi_scheme        $scheme;          #values relay nginx uwsgi         uwsgi_param             ssl_client_cert     $ssl_client_cert;         uwsgi_param             ssl_client_raw_cert $ssl_client_raw_cert;         uwsgi_param             ssl_client_verify   $ssl_client_verify;          uwsgi_param             server_software     nginx/$nginx_version;     }  }   upstream django {     # server unix:///path/to/your/mysite/mysite.sock; # file socket     server 127.0.0.1:8081; # web port socket (we'll use first) }  # graphite server {     listen      8091;     server_name $hostname; # substitute machine's ip address or fqdn     charset     utf-8;     ssl         off;      # max upload size     client_max_body_size 75m;   # adjust taste      location /graphite/ {         proxy_pass http://127.0.0.1:8081/;         proxy_redirect http://127.0.0.1:8081/graphite/ http://$host/graphite/;         proxy_set_header        host $host;         proxy_set_header        script_name /graphite;     }      location / {         proxy_pass http://127.0.0.1:8091/graphite/;     } } 

the following /etc/nginx/sites-enabled/graphite-statsd.conf docker image:

server {   listen 80;   root /opt/graphite/webapp/content;   index index.html;    location /media {     # django admin static files     alias /usr/local/lib/python2.7/dist-packages/django/contrib/admin/media/;   }    location /admin/auth/admin {     alias /usr/local/lib/python2.7/dist-packages/django/contrib/admin/static/admin;   }    location /admin/auth/user/admin {     alias /usr/local/lib/python2.7/dist-packages/django/contrib/admin/static/admin;   }    location / {     # checks static file, if not found proxy app     try_files \$uri @app;   }    location @app {     include fastcgi_params;     fastcgi_split_path_info ^()(.*)$;     fastcgi_pass 127.0.0.1:8080;     add_header 'access-control-allow-origin' '*';     add_header 'access-control-allow-methods' 'get, post, options';     add_header 'access-control-allow-headers' 'authorization, content-type';     add_header 'access-control-allow-credentials' 'true';   } } 

i pretty new configuring nginx , have never used django before, sure configuration has several problems. appreciated! apologies spaces in urls.


Comments

Popular posts from this blog

Qt QGraphicsScene is not accessable from QGraphicsView (on Qt 5.6.1) -

php - Cannot override Laravel Spark authentication with own implementation -

What is happening when Matlab is starting a "parallel pool"? -