Question: Upload/Downloads fail when serving galaxy from a subdirectory
0
gravatar for david.roquis
21 months ago by
david.roquis30
david.roquis30 wrote:

Hello everyone,

I am setting up a Galaxy (v17.01 jan2017) production server on our cluster (I am still in the early steps of doing that). I am using NGINX (v1.10.1, manually compiled with upload module) as a proxy server. Both uploads and downloads are managed by NGINX. I serve with no subdirectory (i.e. myserver.de), everything works like a charm.

However, when I try to serve with a sub-directory (i.e. myserver.de/galaxy) both uploads (error 404) and downloads (nothing happen when I click) through Galaxy fail. I followed this tutorial when trying to set that up: https://wiki.galaxyproject.org/Admin/Config/nginxProxy.

I have spent my whole day trying to figure out why, and I miserably failed. Could anyone help me with this issue?

Also, probably a very dumb question, but where should I put the /galaxy/ prefix at this location in the nginx.conf? I tried several position but NGINX did not like it.

# serve static content for visualization and interactive environment plugins
location ~ ^/plugins/(?<plug_type>.+?)/(?<vis_name>.+?)/static/(?<static_file>.*?)${
alias /mnt/extStorate/galaxy-app/config/plugins/$plug_type/$vis_name/static/$static_file;

Thank you very much in advance

David

Here are the lines I have modified in the galaxy.ini file

##Mapping galaxy to another port, to allow to proxy it through NGINX
31  port = 8080

##Disable the developer settings
79  #filter-with = gzip
794 debug = False
807 use_interactive = False

##Managing connections to the PostgreSQL database
98  database_connection = postgresql://galaxy:XXXXXXXXX@localhost:5432/XXXXXXXXXsql
113 database_engine_option_server_side_cursors = True

##Serving Galaxy from a subdirectory (here /galaxy)
62  use = egg:PasteDeploy#prefix
63  prefix = /galaxy
84  filter-with = proxy-prefix
90  cookie_path = /galaxy

##Sending files using NGINX
630 nginx_x_accel_redirect_base = /_x_accel_redirect

##Receiving files using NGINX
639 upstream_gzip = True
655 nginx_upload_store = database/tmp/upload_store
660 nginx_upload_path = /_upload

and here is my nginx.conf

user  galaxy;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

pid        /run/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #Add this to serve rstudio-server from NGINX
    map $http_upgrade $connection_upgrade {
      default upgrade;
      ''      close;
    }


    #gzip compression on the fly, useful for Galaxy
    gzip  on;
    gzip_http_version 1.1;
    gzip_vary on;
    gzip_comp_level 4;
    gzip_proxied any;
    gzip_types text/plain text/css application/x-javascript text/xml application/xml text/javascript application/json application/javascript;
    gzip_buffers 16 8k;
    gzip_disable "MSIE [1-6].(?!.*SV1)";

    upstream galaxy_app {
        server localhost:8080;
    }
    # if using more than one upstream, disable nginx's round-robin
    # scheme to prevent it from submitting POST requests more than
    #  once (this is unsafe)

    proxy_next_upstream off;

    server {
        client_max_body_size 10G;
        listen       80;
        server_name  localhost;

        #To serve rstudio-server from custom path (i.e. localhost/rstudio)
        location /rstudio/ {
            rewrite ^/rstudio/(.*)$ /$1 break;
            proxy_pass localhost:8787;
            proxy_redirect localhost:8787/ $scheme://$host/rstudio/;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection $connection_upgrade;
            proxy_read_timeout 20d;
        }


        #charset koi8-r;

        #access_log  logs/host.access.log  main;

    #To serve galaxy from custom path (i.e. localhost/galaxy)
        location /galaxy {
            proxy_pass   http://galaxy_app;
            proxy_set_header   X-Forwarded-Host $host;
            proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
        }
        # serve static content for visualization and interactive environment plugins
        location ~ ^/plugins/(?<plug_type>.+?)/(?<vis_name>.+?)/static/(?<static_file>.*?)$ {
            alias /mnt/extStorate/galaxy-app/config/plugins/$plug_type/$vis_name/static/$static_file;
        }
        location /galaxy/static {
            alias /mnt/extStorate/galaxy-app/static;
            expires 24h;
        }
        location /galaxy/static/style {
            alias /mnt/extStorate/galaxy-app/static/style/blue;
            expires 24h;
        }
        location /galaxy/static/scripts {
            alias /mnt/extStorate/galaxy-app/static/scripts;
            expires 24h;
        }
        location /galaxy/favicon.ico {
            alias /mnt/extStorate/galaxy-app/static/favicon.ico;
        }
        location /galaxy/robots.txt {
            alias /mnt/extStorate/galaxy-app/static/robots.txt;
        }
        location /galaxy/_x_accel_redirect/ {
            internal;
            alias /;
        }
        location /galaxy/_upload {
            upload_store /mnt/extStorate/galaxy-app/database/tmp/upload_store;
            upload_pass_form_field "";
            upload_set_form_field "__${upload_field_name}__is_composite" "true";
            upload_set_form_field "__${upload_field_name}__keys" "name path";
            upload_set_form_field "${upload_field_name}_name" "$upload_file_name";
            upload_set_form_field "${upload_field_name}_path" "$upload_tmp_path";
            upload_pass_args on;
            upload_pass /_upload_done;
        }
        location /galaxy/_upload_done {
            set $dst /galaxy/api/tools;
            if ($args ~ nginx_redir=([^&]+)) {
                set $dst $1;
            }
            rewrite "" $dst;
        }


        location / {
            root   html;
            index  index.html index.htm;
        }

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }
}
galaxy • 839 views
ADD COMMENTlink modified 20 months ago • written 21 months ago by david.roquis30
0
gravatar for david.roquis
21 months ago by
david.roquis30
david.roquis30 wrote:

No idea anyone? I have still be trying but can't figure out how to solve this problem.

ADD COMMENTlink written 21 months ago by david.roquis30
0
gravatar for paolo.angelino
20 months ago by
paolo.angelino0 wrote:

since you have changed:

location /galaxy/_upload {
        upload_store /mnt/extStorate/galaxy-app/database/tmp/upload_store;
...

in nginx.conf, ngynx is now listening at the url /galaxy/_upload. Therefore, you should change also the galaxy.ini file for galaxy to provide the correct url:

nginx_upload_path = /galaxy/_upload
ADD COMMENTlink written 20 months ago by paolo.angelino0
0
gravatar for david.roquis
20 months ago by
david.roquis30
david.roquis30 wrote:

Thanks a lot! It works perfectly now!

ADD COMMENTlink written 20 months ago by david.roquis30
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 169 users visited in the last hour